import java.awt.Color;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.GradientPaint;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import javax.imageio.ImageIO;
import javax.swing.JLabel;
import org.rsbot.event.events.MessageEvent;
import org.rsbot.event.listeners.MessageListener;
import org.rsbot.event.listeners.PaintListener;
import org.rsbot.script.Script;
import org.rsbot.script.ScriptManifest;
import org.rsbot.script.methods.Bank;
import org.rsbot.script.methods.Calculations;
import org.rsbot.script.methods.Camera;
import org.rsbot.script.methods.Combat;
import org.rsbot.script.methods.Environment;
import org.rsbot.script.methods.Equipment;
import org.rsbot.script.methods.Game;
import org.rsbot.script.methods.Interfaces;
import org.rsbot.script.methods.Inventory;
import org.rsbot.script.methods.Keyboard;
import org.rsbot.script.methods.Magic;
import org.rsbot.script.methods.Menu;
import org.rsbot.script.methods.Mouse;
import org.rsbot.script.methods.NPCs;
import org.rsbot.script.methods.Objects;
import org.rsbot.script.methods.Players;
import org.rsbot.script.methods.Skills;
import org.rsbot.script.methods.Walking;
import org.rsbot.script.util.Timer;
import org.rsbot.script.wrappers.RSArea;
import org.rsbot.script.wrappers.RSComponent;
import org.rsbot.script.wrappers.RSInterface;
import org.rsbot.script.wrappers.RSItem;
import org.rsbot.script.wrappers.RSModel;
import org.rsbot.script.wrappers.RSNPC;
import org.rsbot.script.wrappers.RSObject;
import org.rsbot.script.wrappers.RSPlayer;
import org.rsbot.script.wrappers.RSTile;
import org.rsbot.util.GlobalConfiguration.Paths;

@ScriptManifest(authors={"TerraBubble"}, keywords={"Combat"}, name="FOGRunner", version=1.5D, description="A Fist of Guthix playing script by TerraBubble")
public class FOGRunner extends Script
  implements PaintListener, MessageListener, MouseListener, MouseMotionListener
{
  final ScriptManifest properties;
  private FOGRunner.FOGRunnerGUI gui;
  public BufferedImage normal;
  public BufferedImage clicked;
  public BufferedImage upArrow;
  public BufferedImage downArrow;
  public int cornerNum;
  public int statsPaint;
  public double statsAlpha;
  public long startTime;
  public long runTime;
  public long seconds;
  public long minutes;
  public long hours;
  public int startTokens;
  public int tokensPerHour;
  public int tokensGained;
  public int currentTokens;
  public int bankedTokens;
  public int gamesPlayed;
  public int gamesPerHour;
  public int gamesWon;
  public int gamesLost;
  public int userMouseX;
  public int userMouseY;
  public boolean userMousePressed;
  public int moreStats;
  public int moreStatsOffset;
  public double[] textAlpha;
  public int gamesWonPerHour;
  public int gamesLostPerHour;
  public int averageCharges;
  public int averageChargesOpponent;
  public int totalCharges;
  public int totalChargesO;
  public int startRating;
  public int currentRating;
  public int gainedRating;
  public int statusPaint;
  public double statusAlpha;
  public String status;
  public String overallStatus;
  public int expPaint;
  public double expAlpha;
  public int[] expYs;
  public int nextPlace;
  public int startAttackExp;
  public int startStrengthExp;
  public int startDefenceExp;
  public int startMagicExp;
  public int startRangeExp;
  public int startConstitutionExp;
  public int startAttackLevel;
  public int startStrengthLevel;
  public int startDefenceLevel;
  public int startMagicLevel;
  public int startRangeLevel;
  public int startConstitutionLevel;
  public Rectangle attackBox;
  public Rectangle strengthBox;
  public Rectangle defenceBox;
  public Rectangle magicBox;
  public Rectangle rangeBox;
  public Rectangle constitutionBox;
  public Rectangle expGradientBox;
  public Rectangle statusButtonRec;
  public Rectangle expButtonRec;
  public Rectangle statsButtonRec;
  public Rectangle moreStatsButtonRec;
  public boolean canDrawTheirTile;
  public boolean canDrawInfo;
  public boolean dieScript;
  public BufferedImage banner;
  public boolean success;
  public final File scriptFile;
  public final File settingsFile;
  public final File bannerFile;
  public boolean loadBannerFromFile;
  public boolean useAntiBan;
  public boolean useBandages;
  public boolean usePrayers;
  public boolean useAttackPrayers;
  public boolean useSkinPrayers;
  public boolean useQuickPrayers;
  public String quickPrayersLong;
  public boolean bankTokens;
  public boolean search;
  public boolean screenshots;
  public int tokensBeforeBank;
  public String tokensBeforeBankS;
  public int mouseSpeed;
  public String teleorbLong;
  public String teleorb;
  public int[] inventoryItemsIDsX;
  public int inventoryItemsNumP;
  public int[] inventoryItemsIDsP;
  public String[] inventoryItemsNamesP;
  public int inventoryItemsNum;
  public int[] inventoryItemsIDs;
  public String[] inventoryItemsNames;
  public int equipmentItemsNum;
  public int[] equipmentItemsIDsX;
  public int[] equipmentItemsIDs;
  public String[] equipmentItemsNames;
  public int[] meleeListIDsAdded;
  public int[] magicListIDsAdded;
  public int[] rangeListIDsAdded;
  public int[] meleeEquipment;
  public int[] rangeEquipment;
  public int[] magicEquipment;
  public boolean meleeActive;
  public boolean magicActive;
  public boolean rangeActive;
  public String meleeAttackStyle;
  public String magicSpell;
  public String rangeAttackStyle;
  public String firstStyle;
  public String currentStyle;
  public int inventoryListSelectedID;
  public String[] startStylesP;
  public String[] startStyles1;
  public String[] startStyles2;
  public String[] startStyles3;
  public int[] meleeListIDsAddedDefence;
  public int[] magicListIDsAddedDefence;
  public int[] rangeListIDsAddedDefence;
  public int[] meleeEquipmentDefence;
  public int[] rangeEquipmentDefence;
  public int[] magicEquipmentDefence;
  public boolean meleeActiveDefence;
  public boolean magicActiveDefence;
  public boolean rangeActiveDefence;
  public boolean meleeUnequip;
  public boolean magicUnequip;
  public boolean rangeUnequip;
  public String currentStyleDefence;
  public boolean FSGame;
  public int inventoryListSelectedIDDefence;
  public final int MODERN_SPELLBOOK = 192;
  public final int ANCIENT_SPELLBOOK = 193;
  public final int SPELL_WIND_RUSH = 98;
  public boolean prayerSwitch;
  public boolean meleeSafeSpotSwitch;
  public boolean randomGameSwitch;
  public int nextRandomSwitch;
  public boolean everyGameSwitch;
  public boolean hitSwitch;
  public int hitSwitchMinHits;
  public int hitSwitchMaxHits;
  public int nextHitSwitch;
  public int hits;
  public int lastKnownHealth;
  public boolean nextRandomSwitchSet;
  public boolean justStarted;
  public boolean gotRatingInfo;
  public RSTile entranceBefore;
  public RSTile entrance;
  public boolean loginWait;
  public boolean meleeTimerStarted;
  public Timer meleeTimer;
  public boolean initialised;
  public boolean justPlayed;
  public boolean walkedOnce;
  public boolean stoneHovered;
  public final int[] eComps;
  public int prevHg;
  public int prevHd;
  public boolean roundOneHunted;
  public boolean switchingRole;
  public boolean hunted;
  public boolean hunted2;
  public boolean setVarsRound1;
  public boolean setVarsRound2;
  public boolean gone;
  public boolean gone2;
  public boolean startedUp;
  public boolean startedUp2;
  public int round;
  public boolean antiBanTime;
  public boolean goReceived;
  public Timer goTimer;
  public int canGoFailed;
  public boolean overrideGoReceived;
  public Timer t;
  public Timer t2;
  public Timer s;
  public boolean timerStarted;
  public int timerToUse;
  public RSTile lastKnownLoc;
  public boolean searching;
  public int spawnArea;
  public RSTile centerTile;
  public final int[] searchTilesXOrig;
  public final int[] searchTilesYOrig;
  public int[] searchTilesX;
  public int[] searchTilesY;
  public int searchTileOn;
  public boolean dmode;
  public int prayerlvl;
  public int lastPrayerSet;
  public int lastAttackPrayerSet;
  public int lastSkinPrayerSet;
  public boolean setCombatSpells;
  public int tRandom;
  public String UBIString;
  public boolean bankingUBIs;
  public final int[] food;
  public final int[] otherNAIDs;
  public final int[] NAIDs;
  public final RSTile waitingRoomTile;
  public int tokenID;
  public int teleorbID;
  public int bandagesID;
  public int[] stoneID;
  public RSObject stoneObject;
  public FOGRunner.FOGItem druidic_mage_top;
  public FOGRunner.FOGItem druidic_mage_bottom;
  public FOGRunner.FOGItem druidic_mage_hood;
  public FOGRunner.FOGItem combat_robe_top;
  public FOGRunner.FOGItem combat_robe_bottom;
  public FOGRunner.FOGItem combat_hood;
  public FOGRunner.FOGItem green_dhide_coif;
  public FOGRunner.FOGItem bronze_gauntlets;
  public FOGRunner.FOGItem iron_gauntlets;
  public FOGRunner.FOGItem steel_gauntlets;
  public FOGRunner.FOGItem black_gauntlets;
  public FOGRunner.FOGItem mithril_gauntlets;
  public FOGRunner.FOGItem adamant_gauntlets;
  public FOGRunner.FOGItem rune_gauntlets;
  public FOGRunner.FOGItem adamant_spikeshield;
  public FOGRunner.FOGItem adamant_berserker_shield;
  public FOGRunner.FOGItem rune_spikeshield;
  public FOGRunner.FOGItem rune_berserker_shield;
  public FOGRunner.FOGItem dragon_gauntlets;
  public FOGRunner.FOGItem blue_dhide_coif;
  public FOGRunner.FOGItem red_dhide_coif;
  public FOGRunner.FOGItem black_dhide_coif;
  public FOGRunner.FOGItem battle_robe_top;
  public FOGRunner.FOGItem battle_robe_bottom;
  public FOGRunner.FOGItem battle_hood;
  public FOGRunner.FOGItem[] FOGItemsF2P;
  public FOGRunner.FOGItem[] FOGItemsP2P;
  public FOGRunner.FOGItem[] FOGItems;
  public FOGRunner.FOGItem f2pItem;
  public FOGRunner.FOGItem p2pItem;
  public int[] v;

  public FOGRunner()
  {
    this.properties = ((ScriptManifest)getClass().getAnnotation(ScriptManifest.class));

    this.normal = null;
    this.clicked = null;
    this.upArrow = null;
    this.downArrow = null;

    this.cornerNum = 5;
    this.statsPaint = 2;
    this.statsAlpha = 1.0D;
    this.startTime = System.currentTimeMillis();
    this.runTime = 0L;
    this.seconds = 0L;
    this.minutes = 0L;
    this.hours = 0L;
    this.startTokens = 0;
    this.tokensPerHour = 0;
    this.tokensGained = 0;
    this.currentTokens = 0;
    this.bankedTokens = 0;
    this.gamesPlayed = 0;
    this.gamesPerHour = 0;
    this.gamesWon = 0;
    this.gamesLost = 0;
    this.userMouseX = 0;
    this.userMouseY = 0;
    this.userMousePressed = false;

    this.moreStats = 0;
    this.moreStatsOffset = 0;
    this.textAlpha = new double[] { 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D, 0.0D };
    this.gamesWonPerHour = 0;
    this.gamesLostPerHour = 0;
    this.averageCharges = 0;
    this.averageChargesOpponent = 0;
    this.totalCharges = 0;
    this.totalChargesO = 0;
    this.startRating = 0;
    this.currentRating = 0;
    this.gainedRating = 0;

    this.statusPaint = 2;
    this.statusAlpha = 1.0D;
    this.status = "Starting Up...";
    this.overallStatus = "NULL";

    this.expPaint = 2;
    this.expAlpha = 1.0D;
    this.expYs = new int[] { 345, 358, 371, 384, 397, 410, 423 };
    this.nextPlace = 0;
    this.startAttackExp = 0;
    this.startStrengthExp = 0;
    this.startDefenceExp = 0;
    this.startMagicExp = 0;
    this.startRangeExp = 0;
    this.startConstitutionExp = 0;
    this.startAttackLevel = 0;
    this.startStrengthLevel = 0;
    this.startDefenceLevel = 0;
    this.startMagicLevel = 0;
    this.startRangeLevel = 0;
    this.startConstitutionLevel = 0;
    this.attackBox = new Rectangle(7, 0, 490, 13);
    this.strengthBox = new Rectangle(this.attackBox.x, 0, this.attackBox.width, this.attackBox.height);

    this.defenceBox = new Rectangle(this.attackBox.x, 0, this.attackBox.width, this.attackBox.height);

    this.magicBox = new Rectangle(this.attackBox.x, 0, this.attackBox.width, this.attackBox.height);

    this.rangeBox = new Rectangle(this.attackBox.x, 0, this.attackBox.width, this.attackBox.height);

    this.constitutionBox = new Rectangle(this.attackBox.x, 0, this.attackBox.width, this.attackBox.height);

    this.expGradientBox = new Rectangle(this.attackBox.x, this.expYs[this.nextPlace], this.attackBox.width, 30);

    this.statusButtonRec = new Rectangle(560, 443, 51, 15);
    this.expButtonRec = new Rectangle(this.statusButtonRec.x + 57, 443, 51, 15);

    this.statsButtonRec = new Rectangle(this.expButtonRec.x + 57, 443, 51, 15);

    this.moreStatsButtonRec = new Rectangle(this.expButtonRec.x - 10, 428, 71, 12);

    this.canDrawTheirTile = false;
    this.canDrawInfo = false;

    this.dieScript = false;
    this.banner = null;
    this.success = false;
    this.scriptFile = new File(new File(GlobalConfiguration.Paths.getScriptsSourcesDirectory()), "FOGRunner.java");

    this.settingsFile = new File(new File(GlobalConfiguration.Paths.getSettingsDirectory()), "FOGRunner.txt");

    this.bannerFile = new File(new File(GlobalConfiguration.Paths.getScriptsDirectory()), "FOGRunner.png");

    this.loadBannerFromFile = true;

    this.useAntiBan = true;
    this.useBandages = true;
    this.usePrayers = false;
    this.useAttackPrayers = false;
    this.useSkinPrayers = false;
    this.useQuickPrayers = false;
    this.quickPrayersLong = "When Hunting";
    this.bankTokens = false;
    this.search = true;
    this.screenshots = true;
    this.tokensBeforeBank = 9000;
    this.tokensBeforeBankS = "9000";
    this.mouseSpeed = 7;

    this.teleorbLong = "When being Hunted";
    this.teleorb = "NULL";

    this.inventoryItemsIDsX = new int[28];

    this.inventoryItemsIDsP = new int[28];
    this.inventoryItemsNamesP = new String[28];
    this.inventoryItemsNum = 0;
    this.inventoryItemsIDs = new int[39];
    this.inventoryItemsNames = new String[39];

    this.equipmentItemsIDsX = new int[11];
    this.equipmentItemsIDs = new int[11];
    this.equipmentItemsNames = new String[11];

    this.meleeListIDsAdded = new int[11];
    this.magicListIDsAdded = new int[11];
    this.rangeListIDsAdded = new int[11];

    this.meleeActive = true;
    this.magicActive = true;
    this.rangeActive = false;

    this.meleeAttackStyle = "Attack EXP";
    this.magicSpell = "Auto Highest (F2P)";
    this.rangeAttackStyle = "Accurate";

    this.firstStyle = "Melee";

    this.currentStyle = "Melee";

    this.startStylesP = new String[3];
    this.startStyles1 = new String[1];
    this.startStyles2 = new String[2];
    this.startStyles3 = new String[3];

    this.meleeListIDsAddedDefence = new int[11];
    this.magicListIDsAddedDefence = new int[11];
    this.rangeListIDsAddedDefence = new int[11];

    this.meleeActiveDefence = true;
    this.magicActiveDefence = true;
    this.rangeActiveDefence = false;

    this.meleeUnequip = false;
    this.magicUnequip = false;
    this.rangeUnequip = false;

    this.currentStyleDefence = "Melee";
    this.FSGame = false;

    this.MODERN_SPELLBOOK = 192;
    this.ANCIENT_SPELLBOOK = 193;
    this.SPELL_WIND_RUSH = 98;

    this.prayerSwitch = false;
    this.meleeSafeSpotSwitch = false;
    this.randomGameSwitch = true;
    this.nextRandomSwitch = 3;
    this.everyGameSwitch = false;
    this.hitSwitch = false;
    this.hitSwitchMinHits = 3;
    this.hitSwitchMaxHits = 5;
    this.nextHitSwitch = 4;
    this.hits = 0;
    this.lastKnownHealth = 100;
    this.nextRandomSwitchSet = false;
    this.justStarted = true;
    this.gotRatingInfo = true;

    this.entranceBefore = new RSTile(1717, 5598);
    this.entrance = new RSTile(1719, 5599);

    this.loginWait = false;
    this.meleeTimerStarted = false;

    this.meleeTimer = new Timer(100L);

    this.initialised = false;
    this.justPlayed = false;
    this.walkedOnce = false;

    this.stoneHovered = false;

    this.eComps = new int[] { 8, 11, 14, 17, 20, 23, 26, 29, 32, 35, 38 };

    this.prevHg = -1;
    this.prevHd = -1;
    this.roundOneHunted = false;
    this.switchingRole = false;
    this.hunted = true;
    this.hunted2 = true;

    this.setVarsRound1 = false;
    this.setVarsRound2 = false;

    this.gone = false;
    this.gone2 = false;
    this.startedUp = false;
    this.startedUp2 = false;
    this.round = 1;

    this.antiBanTime = true;

    this.goReceived = false;
    this.goTimer = new Timer(5000L);

    this.canGoFailed = 0;
    this.overrideGoReceived = false;

    this.t = new Timer(8000L);
    this.t2 = new Timer(30000L);

    this.s = new Timer(10000L);

    this.timerStarted = false;
    this.timerToUse = 1;

    this.lastKnownLoc = new RSTile(-1, -1);
    this.searching = false;
    this.spawnArea = 0;
    this.centerTile = new RSTile(1663, 5696);
    this.searchTilesXOrig = new int[] { 1663, 1677, 1688, 1682, 1659, 1644, 1637, 1649 };

    this.searchTilesYOrig = new int[] { 5717, 5708, 5692, 5677, 5671, 5681, 5698, 5712 };

    this.searchTilesX = new int[] { 1663, 1677, 1688, 1682, 1659, 1644, 1637, 1649 };

    this.searchTilesY = new int[] { 5717, 5708, 5692, 5677, 5671, 5681, 5698, 5712 };

    this.searchTileOn = 0;

    this.dmode = false;

    this.lastPrayerSet = 0;
    this.lastAttackPrayerSet = 0;
    this.lastSkinPrayerSet = -1;

    this.setCombatSpells = false;

    this.tRandom = 1;

    this.UBIString = "";
    this.bankingUBIs = false;
    this.food = new int[] { 1895, 1893, 1891, 4293, 2142, 291, 2140, 3228, 9980, 7223, 6297, 6293, 6295, 6299, 7521, 9988, 7228, 2878, 7568, 2343, 1861, 13433, 315, 325, 319, 3144, 347, 355, 333, 339, 351, 329, 3381, 361, 10136, 5003, 379, 365, 373, 7946, 385, 397, 391, 3369, 3371, 3373, 2309, 2325, 2333, 2327, 2331, 2323, 2335, 7178, 7180, 7188, 7190, 7198, 7200, 7208, 7210, 7218, 7220, 2003, 2011, 2289, 2291, 2293, 2295, 2297, 2299, 2301, 2303, 1891, 1893, 1895, 1897, 1899, 1901, 7072, 7062, 7078, 7064, 7084, 7082, 7066, 7068, 1942, 6701, 6703, 7054, 6705, 7056, 7060, 2130, 1985, 1993, 1989, 1978, 5763, 5765, 1913, 5747, 1905, 5739, 1909, 5743, 1907, 1911, 5745, 2955, 5749, 5751, 5753, 5755, 5757, 5759, 5761, 2084, 2034, 2048, 2036, 2217, 2213, 2205, 2209, 2054, 2040, 2080, 2277, 2225, 2255, 2221, 2253, 2219, 2281, 2227, 2223, 2191, 2233, 2092, 2032, 2074, 2030, 2281, 2235, 2064, 2028, 2187, 2185, 2229, 6883, 1971, 4608, 1883, 1885, 1973, 15272, 6962, 1969, 403 };

    this.otherNAIDs = new int[] { 434, 592 };

    this.NAIDs = concat(this.food, this.otherNAIDs);

    this.waitingRoomTile = new RSTile(1653, 5300);

    this.tokenID = 12852;
    this.teleorbID = 12855;
    this.bandagesID = 12853;
    this.stoneID = new int[] { 12845, 12846, 12847, 12848, 12849 };

    this.druidic_mage_top = new FOGRunner.FOGItem(this, "Druidic Mage Top", 12899, 300, false);

    this.druidic_mage_bottom = new FOGRunner.FOGItem(this, "Druidic Mage Bottom", 12906, 200, false);

    this.druidic_mage_hood = new FOGRunner.FOGItem(this, "Druidic Mage Hood", 12892, 100, false);

    this.combat_robe_top = new FOGRunner.FOGItem(this, "Combat Robe Top", 12976, 150, false);

    this.combat_robe_bottom = new FOGRunner.FOGItem(this, "Combat Robe Bottom", 12983, 100, false);

    this.combat_hood = new FOGRunner.FOGItem(this, "Combat Hood", 12969, 50, false);
    this.green_dhide_coif = new FOGRunner.FOGItem(this, "Green D'Hide Coif", 12941, 150, false);

    this.bronze_gauntlets = new FOGRunner.FOGItem(this, "Bronze Gauntlets", 12986, 15, false);

    this.iron_gauntlets = new FOGRunner.FOGItem(this, "Iron Gauntlets", 12989, 30, false);

    this.steel_gauntlets = new FOGRunner.FOGItem(this, "Steel Gauntlets", 12992, 50, false);

    this.black_gauntlets = new FOGRunner.FOGItem(this, "Black Gauntlets", 12995, 75, false);

    this.mithril_gauntlets = new FOGRunner.FOGItem(this, "Mithril Gauntlets", 12998, 100, false);

    this.adamant_gauntlets = new FOGRunner.FOGItem(this, "Adamant Gauntlets", 13001, 150, false);

    this.rune_gauntlets = new FOGRunner.FOGItem(this, "Rune Gauntlets", 13004, 200, false);

    this.adamant_spikeshield = new FOGRunner.FOGItem(this, "Adamant Spikeshield", 12913, 50, false);

    this.adamant_berserker_shield = new FOGRunner.FOGItem(this, "Adamant Berserker Shield", 12920, 100, false);

    this.rune_spikeshield = new FOGRunner.FOGItem(this, "Rune Spikeshield", 12927, 200, false);

    this.rune_berserker_shield = new FOGRunner.FOGItem(this, "Rune Berserker Shield", 12934, 300, false);

    this.dragon_gauntlets = new FOGRunner.FOGItem(this, "Dragon Gauntlets", 13007, 300, true);

    this.blue_dhide_coif = new FOGRunner.FOGItem(this, "Blue D'Hide Coif", 12948, 200, true);

    this.red_dhide_coif = new FOGRunner.FOGItem(this, "Red D'Hide Coif", 12955, 300, true);

    this.black_dhide_coif = new FOGRunner.FOGItem(this, "Black D'Hide Coif", 12962, 500, true);

    this.battle_robe_top = new FOGRunner.FOGItem(this, "Battle Robe Top", 12878, 1500, true);

    this.battle_robe_bottom = new FOGRunner.FOGItem(this, "Battle Robe Bottom", 12885, 1000, true);

    this.battle_hood = new FOGRunner.FOGItem(this, "Battle Hood", 12871, 250, true);

    this.FOGItemsF2P = new FOGRunner.FOGItem[] { this.druidic_mage_top, this.druidic_mage_bottom, this.druidic_mage_hood, this.combat_robe_top, this.combat_robe_bottom, this.combat_hood, this.green_dhide_coif, this.bronze_gauntlets, this.iron_gauntlets, this.steel_gauntlets, this.black_gauntlets, this.mithril_gauntlets, this.adamant_gauntlets, this.rune_gauntlets, this.adamant_spikeshield, this.adamant_berserker_shield, this.rune_spikeshield, this.rune_berserker_shield };

    this.FOGItemsP2P = new FOGRunner.FOGItem[] { this.dragon_gauntlets, this.blue_dhide_coif, this.red_dhide_coif, this.black_dhide_coif, this.battle_robe_top, this.battle_robe_bottom, this.battle_hood };

    this.FOGItems = concat(this.FOGItemsF2P, this.FOGItemsP2P);

    this.v = new int[100];
  }

  public Point getPlayerScreenLoc()
  {
    Point localPoint = new Point(245, 156);
    try {
      if (this.calc.tileOnScreen(getPlayerLocThrow()))
        localPoint = this.calc.tileToScreen(getPlayerLocThrow(), 4);
    }
    catch (NullPointerException localNullPointerException) {
    }
    return localPoint;
  }

  public Point getPlayerScreenLocThrow() throws NullPointerException {
    Point localPoint = new Point(245, 156);
    if (this.calc.tileOnScreen(getPlayerLocThrow())) {
      localPoint = this.calc.tileToScreen(getPlayerLocThrow(), 4);
    }
    return localPoint;
  }

  public RSTile getPlayerLoc() {
    try {
      return getPlayer().getLocation();
    } catch (NullPointerException localNullPointerException) {
    }
    return new RSTile(0, 0);
  }

  public RSTile getPlayerLocThrow() throws NullPointerException {
    RSTile localRSTile = getPlayerThrow().getLocation();
    return localRSTile;
  }

  public boolean playerLocKnown()
  {
    return (getPlayerLoc().getX() != 0) || (getPlayerLoc().getY() != 0);
  }

  public RSPlayer getPlayer()
  {
    String str = this.interfaces.get(730).getComponent(18).getText();
    RSPlayer[] arrayOfRSPlayer = this.players.getAll();
    int i = 0;
    while (i < arrayOfRSPlayer.length) {
      if (arrayOfRSPlayer[i] == null) continue;
      try {
        if (arrayOfRSPlayer[i].getName().equals(str))
          return arrayOfRSPlayer[i];
      }
      catch (NullPointerException localNullPointerException) {
      }
      i++;
    }

    return null;
  }

  public RSPlayer getPlayerThrow() throws NullPointerException {
    String str = this.interfaces.get(730).getComponent(18).getText();
    RSPlayer[] arrayOfRSPlayer = this.players.getAll();
    int i = 0;
    while (i < arrayOfRSPlayer.length) {
      if (arrayOfRSPlayer[i] == null) continue;
      try {
        if (arrayOfRSPlayer[i].getName().equals(str))
          return arrayOfRSPlayer[i];
      }
      catch (NullPointerException localNullPointerException) {
      }
      i++;
    }

    throw new NullPointerException();
  }

  public String playerName() {
    return this.interfaces.get(730).getComponent(18).getText();
  }

  public boolean inLobby() {
    int i = getMyPlayer().getLocation().getX();
    int j = getMyPlayer().getLocation().getY();

    return (i <= 1725) && (i >= 1670) && 
      (j <= 5615) && (j >= 5585);
  }

  public boolean inGame()
  {
    int i = getMyPlayer().getLocation().getX();
    int j = getMyPlayer().getLocation().getY();

    return (i <= 1710) && (i >= 1615) && 
      (j <= 5735) && (j >= 5650);
  }

  public boolean inWaitingRoom()
  {
    int i = getMyPlayer().getLocation().getX();
    int j = getMyPlayer().getLocation().getY();

    return (i <= 1660) && (i >= 1610) && 
      (j <= 5620) && (j >= 5600);
  }

  public int getCharges()
  {
    String str1 = this.interfaces.get(730).getComponent(17).getText();
    int i = str1.indexOf(": ");
    String str2 = str1.substring(i + 2);
    int j = Integer.parseInt(str2);
    return j;
  }

  public void setNextHitSwitch()
  {
    int i = this.hitSwitchMinHits * 1000;
    int j = this.hitSwitchMaxHits * 1000;
    int k = random(i, j);
    double d = k / 1000.0D;
    int m = (int)Math.round(d);

    this.nextHitSwitch = m;
  }

  public void setRandomStyle() {
    this.status = "Changing Style...";
    int i = 0;
    if (this.meleeActive) {
      i++;
    }
    if (this.magicActive) {
      i++;
    }
    if (this.rangeActive) {
      i++;
    }

    if (i == 3) {
      int j = random(1, 2);
      switch (j) {
      case 1:
        if (this.currentStyle.equals("Melee")) {
          this.currentStyle = "Magic";
        } else if (this.currentStyle.equals("Magic")) {
          this.currentStyle = "Range"; } else {
          if (!this.currentStyle.equals("Range")) break;
          this.currentStyle = "Melee"; } break;
      case 2:
        if (this.currentStyle.equals("Melee")) {
          this.currentStyle = "Range";
        } else if (this.currentStyle.equals("Magic")) {
          this.currentStyle = "Melee"; } else {
          if (!this.currentStyle.equals("Range")) break;
          this.currentStyle = "Magic";
        }
      }

    }
    else if (i == 2) {
      if (this.currentStyle.equals("Melee")) {
        if (this.magicActive)
          this.currentStyle = "Magic";
        else if (this.rangeActive)
          this.currentStyle = "Range";
      }
      else if (this.currentStyle.equals("Magic")) {
        if (this.rangeActive)
          this.currentStyle = "Range";
        else if (this.meleeActive)
          this.currentStyle = "Melee";
      }
      else if (this.currentStyle.equals("Range")) {
        if (this.meleeActive)
          this.currentStyle = "Melee";
        else if (this.magicActive)
          this.currentStyle = "Magic";
      }
    }
    else if (i == 1) {
      if (this.dmode)
        log("Only one Combat Style active. Cannot switch.");
    }
    else if ((i == 0) && 
      (this.dmode)) {
      log("ERROR - NO COMBAT STYLES");
    }

    if (i > 1) {
      setupStyleEquipment();
      setupStyle();
    }
  }

  public boolean isFOGItem(int paramInt) {
    int i = 0;
    int j = 0;
    while ((i == 0) && (j < this.FOGItems.length)) {
      int k = 0;
      while ((i == 0) && (k < 7)) {
        if (this.FOGItems[j].ID - k == paramInt) {
          i = 1;
          dlog("Found FOG Item: " + paramInt + ", FOGItems[" + j + "] - " + k);
        }

        k++;
      }
      j++;
    }
    return i;
  }

  public boolean isFOGItem2(int paramInt) {
    int i = 0;
    int j = 0;
    while ((i == 0) && (j < this.FOGItems.length)) {
      int k = 0;
      while ((i == 0) && (k < 7)) {
        if (this.FOGItems[j].ID - k == paramInt) {
          i = 1;
        }
        k++;
      }
      j++;
    }
    return i;
  }

  public boolean isFOGItemInInv(int paramInt) {
    int i = paramInt;
    int j = 0;
    while (j < this.FOGItems.length) {
      while ((i <= this.FOGItems[j].ID) && (i >= this.FOGItems[j].ID - 5)) {
        if (this.inventory.getCount(false, new int[] { i }) > 0) {
          return true;
        }
        i++;
      }

      j++;
    }
    return false;
  }

  public int wieldFOGItem(int paramInt) {
    int i = -1;
    int j = 0;
    int k = paramInt;
    int m = 0;
    while ((j == 0) && (m < this.FOGItems.length))
    {
      while ((j == 0) && (k <= this.FOGItems[m].ID) && (k >= this.FOGItems[m].ID - 5)) {
        if (this.inventory.getCount(false, new int[] { k }) > 0) {
          if (doActionExtreme(k, "Wear")) {
            j = 1;
            i = k;
            dlog("Wielded (\"Wear\") FOG Item: " + k + ", From old id: " + paramInt + ", FOGItems[" + m + "] - "); continue;
          }

          if (doActionExtreme(k, "Wield")) {
            j = 1;
            i = k;
            dlog("Wielded (\"Wield\") FOG Item: " + k + ", From old id: " + paramInt + ", FOGItems[" + m + "] - "); continue;
          }

          k++; continue;
        }

        k++;
      }

      m++;
    }
    return i;
  }

  public boolean stringArrayContains(String[] paramArrayOfString, String paramString) {
    for (int i = 0; i < paramArrayOfString.length; i++) {
      if (paramArrayOfString[i].contains(paramString)) {
        return true;
      }
    }
    return false;
  }

  public boolean doActionExtreme(int paramInt, String paramString) {
    try {
      RSItem localRSItem = this.inventory.getItem(new int[] { paramInt });
      if (localRSItem == null)
        return false;
      int i = 0;
      while ((!localRSItem.doAction(paramString)) && (i < 10)) {
        i++;
        if ((this.menu.contains(paramString)) || 
          (hoverItemCentre(localRSItem))) continue;
        moveMouseUp();
      }

      if (i < 10)
        return true;
    } catch (NullPointerException localNullPointerException) {
      if (this.dmode)
        localNullPointerException.printStackTrace();
    }
    return false;
  }

  public void moveMouseUp() {
    int i = (int)this.mouse.getLocation().getX();
    int j = (int)this.mouse.getLocation().getY();
    this.mouse.move(i + random(-10, 10), j - random(20, 80));
  }

  public void moveMouseDown() {
    int i = (int)this.mouse.getLocation().getX();
    int j = (int)this.mouse.getLocation().getY();
    this.mouse.move(i + random(-10, 10), j + random(20, 80));
  }

  public boolean hoverItemCentre(RSItem paramRSItem) {
    if ((paramRSItem == null) || (paramRSItem.getComponent() == null) || (paramRSItem.getComponent().getArea() == null) || (paramRSItem.getComponent().getArea().x == -1))
    {
      return false;
    }Rectangle localRectangle = paramRSItem.getComponent().getArea();
    int i = localRectangle.width / 2;
    int j = localRectangle.height / 2;
    int k = localRectangle.x + i / 2;
    int m = localRectangle.y + j / 2;
    new Rectangle(k, m, i, j);
    int n = random(k, k + i);
    int i1 = random(m, m + j);
    this.mouse.move(n, i1);
    return true;
  }

  public void setupStyleEquipment() {
    try {
      if (equipmentItemsInInventory())
      {
        int i;
        int j;
        if (this.currentStyle.equals("Melee")) {
          i = 0;
          while (i < this.meleeEquipment.length) {
            if (this.inventory.getCount(false, new int[] { this.meleeEquipment[i] }) > 0) {
              if ((!doActionExtreme(this.meleeEquipment[i], "Wear")) && 
                (!doActionExtreme(this.meleeEquipment[i], "Wield"))) {
                dlog("Unwearable item: " + this.meleeEquipment[i]);
              }

            }
            else if ((isFOGItem(this.meleeEquipment[i])) && (isFOGItemInInv(this.meleeEquipment[i])))
            {
              j = wieldFOGItem(this.meleeEquipment[i]);
              if (j != -1)
                this.meleeEquipment[i] = j;
              else {
                dlog("Unwearable FOG item: " + this.meleeEquipment[i]);
              }
            }

            i++;
          }
        } else if (this.currentStyle.equals("Magic")) {
          i = 0;
          while (i < this.magicEquipment.length) {
            if (this.inventory.getCount(false, new int[] { this.magicEquipment[i] }) > 0) {
              if ((!doActionExtreme(this.magicEquipment[i], "Wear")) && 
                (!doActionExtreme(this.magicEquipment[i], "Wield"))) {
                dlog("Unwearable item: " + this.magicEquipment[i]);
              }

            }
            else if ((isFOGItem(this.magicEquipment[i])) && (isFOGItemInInv(this.magicEquipment[i])))
            {
              j = wieldFOGItem(this.magicEquipment[i]);
              if (j != -1)
                this.magicEquipment[i] = j;
              else {
                dlog("Unwearable FOG item: " + this.magicEquipment[i]);
              }
            }

            i++;
          }
        } else if (this.currentStyle.equals("Range")) {
          i = 0;
          while (i < this.rangeEquipment.length) {
            if (this.inventory.getCount(false, new int[] { this.rangeEquipment[i] }) > 0) {
              if ((!doActionExtreme(this.rangeEquipment[i], "Wear")) && 
                (!doActionExtreme(this.rangeEquipment[i], "Wield"))) {
                dlog("Unwearable item: " + this.rangeEquipment[i]);
              }

            }
            else if ((isFOGItem(this.rangeEquipment[i])) && (isFOGItemInInv(this.rangeEquipment[i])))
            {
              j = wieldFOGItem(this.rangeEquipment[i]);
              if (j != -1)
                this.rangeEquipment[i] = j;
              else {
                dlog("Unwearable FOG item: " + this.rangeEquipment[i]);
              }
            }

            i++;
          }
        }
      }
    } catch (NullPointerException localNullPointerException) {
    }
  }

  public void setupStyle() {
    if (this.currentStyle.equals("Melee")) {
      if (this.meleeAttackStyle.equals("Attack EXP"))
        this.combat.setFightMode(0);
      else if (this.meleeAttackStyle.equals("Strength EXP"))
        this.combat.setFightMode(1);
      else if (this.meleeAttackStyle.equals("Shared EXP"))
        this.combat.setFightMode(2);
      else if (this.meleeAttackStyle.equals("Defence EXP")) {
        this.combat.setFightMode(3);
      }
    }
    else if (this.currentStyle.equals("Range"))
      if (this.rangeAttackStyle.equals("Accurate"))
        this.combat.setFightMode(0);
      else if (this.rangeAttackStyle.equals("Rapid"))
        this.combat.setFightMode(1);
      else if (this.rangeAttackStyle.equals("Long range"))
        this.combat.setFightMode(2);
  }

  public void setupStyleDefence()
  {
    try
    {
      if (equipmentItemsInInventoryDefence())
      {
        int i;
        int j;
        if (this.currentStyleDefence.equals("Melee")) {
          i = 0;

          while ((i < this.meleeEquipmentDefence.length) && (getMyPlayer().getHPPercent() > 50) && (inGame())) {
            if (this.inventory.getCount(false, new int[] { this.meleeEquipmentDefence[i] }) > 0) {
              if (!doActionExtreme(this.meleeEquipmentDefence[i], "Wear"))
              {
                if (!doActionExtreme(this.meleeEquipmentDefence[i], "Wield"))
                {
                  dlog("Unwearable item: " + this.meleeEquipmentDefence[i]);
                }
              }
            }
            else if ((isFOGItem(this.meleeEquipmentDefence[i])) && (isFOGItemInInv(this.meleeEquipmentDefence[i])))
            {
              j = wieldFOGItem(this.meleeEquipmentDefence[i]);
              if (j != -1)
                this.meleeEquipmentDefence[i] = j;
              else {
                dlog("Unwearable FOG item: " + this.meleeEquipmentDefence[i]);
              }
            }

            i++;
          }
        } else if (this.currentStyleDefence.equals("Magic")) {
          i = 0;

          while ((i < this.magicEquipmentDefence.length) && (getMyPlayer().getHPPercent() > 50) && (inGame())) {
            if (this.inventory.getCount(false, new int[] { this.magicEquipmentDefence[i] }) > 0) {
              if (!doActionExtreme(this.magicEquipmentDefence[i], "Wear"))
              {
                if (!doActionExtreme(this.magicEquipmentDefence[i], "Wield"))
                {
                  dlog("Unwearable item: " + this.magicEquipmentDefence[i]);
                }
              }
            }
            else if ((isFOGItem(this.magicEquipmentDefence[i])) && (isFOGItemInInv(this.magicEquipmentDefence[i])))
            {
              j = wieldFOGItem(this.magicEquipmentDefence[i]);
              if (j != -1)
                this.magicEquipmentDefence[i] = j;
              else {
                dlog("Unwearable FOG item: " + this.magicEquipmentDefence[i]);
              }
            }

            i++;
          }
        } else if (this.currentStyleDefence.equals("Range")) {
          i = 0;

          while ((i < this.rangeEquipmentDefence.length) && (getMyPlayer().getHPPercent() > 50) && (inGame())) {
            if (this.inventory.getCount(false, new int[] { this.rangeEquipmentDefence[i] }) > 0) {
              if (!doActionExtreme(this.rangeEquipmentDefence[i], "Wear"))
              {
                if (!doActionExtreme(this.rangeEquipmentDefence[i], "Wield"))
                {
                  dlog("Unwearable item: " + this.rangeEquipmentDefence[i]);
                }
              }
            }
            else if ((isFOGItem(this.rangeEquipmentDefence[i])) && (isFOGItemInInv(this.rangeEquipmentDefence[i])))
            {
              j = wieldFOGItem(this.rangeEquipmentDefence[i]);
              if (j != -1)
                this.rangeEquipmentDefence[i] = j;
              else {
                dlog("Unwearable FOG item: " + this.rangeEquipmentDefence[i]);
              }
            }

            i++;
          }
        }
      }
    } catch (NullPointerException localNullPointerException) {
    }
  }

  public boolean equipmentItemsInInventory() {
    int i = 0;
    int j;
    if (this.currentStyle.equals("Melee")) {
      if (this.inventory.getCount(false, this.meleeEquipment) > 0) {
        i = 1;
      } else {
        j = 0;
        while ((i == 0) && (j < this.meleeEquipment.length)) {
          if ((isFOGItem2(this.meleeEquipment[j])) && (isFOGItemInInv(this.meleeEquipment[j])))
          {
            i = 1;
          }
          j++;
        }
      }
    } else if (this.currentStyle.equals("Magic")) {
      if (this.inventory.getCount(false, this.magicEquipment) > 0) {
        i = 1;
      } else {
        j = 0;
        while ((i == 0) && (j < this.magicEquipment.length)) {
          if ((isFOGItem2(this.magicEquipment[j])) && (isFOGItemInInv(this.magicEquipment[j])))
          {
            i = 1;
          }
          j++;
        }
      }
    } else if (this.currentStyle.equals("Range")) {
      if (this.inventory.getCount(false, this.rangeEquipment) > 0) {
        i = 1;
      } else {
        j = 0;
        while ((i == 0) && (j < this.rangeEquipment.length)) {
          if ((isFOGItem2(this.rangeEquipment[j])) && (isFOGItemInInv(this.rangeEquipment[j])))
          {
            i = 1;
          }
          j++;
        }
      }
    }
    return i;
  }

  public boolean equipmentItemsInInventoryDefence() {
    int i = 0;
    int j;
    if (this.currentStyleDefence.equals("Melee")) {
      if (this.inventory.getCount(false, this.meleeEquipmentDefence) > 0) {
        i = 1;
      } else {
        j = 0;
        while ((i == 0) && (j < this.meleeEquipmentDefence.length)) {
          if ((isFOGItem2(this.meleeEquipmentDefence[j])) && (isFOGItemInInv(this.meleeEquipmentDefence[j])))
          {
            i = 1;
          }
          j++;
        }
      }
    } else if (this.currentStyleDefence.equals("Magic")) {
      if (this.inventory.getCount(false, this.magicEquipmentDefence) > 0) {
        i = 1;
      } else {
        j = 0;
        while ((i == 0) && (j < this.magicEquipmentDefence.length)) {
          if ((isFOGItem2(this.magicEquipmentDefence[j])) && (isFOGItemInInv(this.magicEquipmentDefence[j])))
          {
            i = 1;
          }
          j++;
        }
      }
    } else if (this.currentStyleDefence.equals("Range")) {
      if (this.inventory.getCount(false, this.rangeEquipmentDefence) > 0) {
        i = 1;
      } else {
        j = 0;
        while ((i == 0) && (j < this.rangeEquipmentDefence.length)) {
          if ((isFOGItem2(this.rangeEquipmentDefence[j])) && (isFOGItemInInv(this.rangeEquipmentDefence[j])))
          {
            i = 1;
          }
          j++;
        }
      }
    }
    return i;
  }

  public int itemsInEquipment() {
    int i = 0;
    int j = 0;
    while (j < 11) {
      try {
        RSComponent localRSComponent = this.equipment.getInterface().getComponent(this.eComps[j]);

        String[] arrayOfString = localRSComponent.getActions();
        if (arrayOfString[0].contains("Remove"))
          i++;
      }
      catch (NullPointerException localNullPointerException) {
      }
      j++;
    }
    return i;
  }

  public void unequipAll() {
    while (this.game.getCurrentTab() != 5) {
      this.game.openTab(5);
      sleep(101);
    }
    while (itemsInEquipment() > 0) {
      RSItem[] arrayOfRSItem = this.equipment.getItems();
      String[] arrayOfString1 = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10" };

      List localList = Arrays.asList(arrayOfString1);
      Collections.shuffle(localList);
      Object[] arrayOfObject = new Object[11];
      String[] arrayOfString2 = new String[11];
      arrayOfObject = localList.toArray();
      for (int i = 0; i < 11; i++) {
        arrayOfString2[i] = arrayOfObject[i].toString();
      }
      int[] arrayOfInt = new int[11];
      for (int j = 0; j < 11; j++) {
        arrayOfInt[j] = Integer.parseInt(arrayOfString2[j]);
      }
      for (j = 0; j < 11; j++)
        try {
          int k = arrayOfInt[j];
          if (this.equipment.getInterface().getComponent(this.eComps[k]).getActions()[0].contains("Remove"))
          {
            if (arrayOfRSItem[k].doAction("Remove")) {
              if (itemsInEquipment() < 3) {
                sleep(700);
              }
              sleep(random(50, 150));
            }
          }
        }
        catch (NullPointerException localNullPointerException) {
        }
    }
    this.game.openTab(4);
    sleep(200);
  }

  public void initialise()
  {
    if (this.game.isLoggedIn())
    {
      this.startAttackExp = this.skills.getCurrentExp(0);
      this.startStrengthExp = this.skills.getCurrentExp(2);
      this.startDefenceExp = this.skills.getCurrentExp(1);
      this.startMagicExp = this.skills.getCurrentExp(6);
      this.startRangeExp = this.skills.getCurrentExp(4);
      this.startConstitutionExp = this.skills.getCurrentExp(3);

      this.startAttackLevel = this.skills.getRealLevel(0);
      this.startStrengthLevel = this.skills.getRealLevel(2);
      this.startDefenceLevel = this.skills.getRealLevel(1);
      this.startMagicLevel = this.skills.getRealLevel(6);
      this.startRangeLevel = this.skills.getRealLevel(4);
      this.startConstitutionLevel = this.skills.getRealLevel(3);
    }

    if (!this.dieScript)
    {
      this.status = "Checking Items...";

      clearItemListArrays();
      this.startStylesP[0] = "Melee";
      this.startStylesP[1] = "Magic";
      this.startStylesP[2] = "NULL";

      clearItemListArraysDefence();

      this.game.openTab(4);
      sleep(50);
      this.inventoryItemsNumP = this.inventory.getCount(false);
      int i = 0;
      while (i < 28) {
        this.inventoryItemsIDsX[i] = this.inventory.getItemAt(i).getID();
        i++;
      }
      int j = 0;
      int k = 0;
      while (j < this.inventoryItemsNumP) {
        if (this.inventoryItemsIDsX[k] == -1) {
          k++; continue;
        }
        this.inventoryItemsIDsP[j] = this.inventoryItemsIDsX[k];
        m = this.inventory.getItemAt(k).getName().indexOf("<col=ff9040>") + 12;

        this.inventoryItemsNamesP[j] = this.inventory.getItemAt(k).getName().substring(m);

        j++;
        k++;
      }

      int m = 0;
      while (m < this.inventoryItemsNumP) {
        this.inventoryItemsIDs[m] = this.inventoryItemsIDsP[m];
        this.inventoryItemsNames[m] = this.inventoryItemsNamesP[m];
        this.inventoryItemsNum += 1;
        m++;
      }

      this.game.openTab(5);
      sleep(50);
      this.equipmentItemsNum = this.equipment.getCount();
      RSItem[] arrayOfRSItem = this.equipment.getItems();
      int n = 0;
      while (n < 11) {
        this.equipmentItemsIDsX[n] = arrayOfRSItem[n].getID();
        n++;
      }
      int i1 = 0;
      int i2 = 0;
      while (i1 < this.equipmentItemsNum) {
        if (this.equipmentItemsIDsX[i2] == -1) {
          i2++; continue;
        }
        this.equipmentItemsIDs[i1] = this.equipmentItemsIDsX[i2];
        i3 = arrayOfRSItem[i2].getName().indexOf("<col=ff9040>") + 12;

        this.equipmentItemsNames[i1] = arrayOfRSItem[i2].getName().substring(i3);

        i1++;
        i2++;
      }

      int i3 = 0;
      while (i3 < this.equipmentItemsNum) {
        this.inventoryItemsIDs[m] = this.equipmentItemsIDs[i3];
        this.inventoryItemsNames[m] = this.equipmentItemsNames[i3];
        this.inventoryItemsNum += 1;
        m++;
        i3++;
      }
      if ((this.magic.getInterface() == null) || (!this.magic.getInterface().isValid())) {
        this.game.openTab(7);
      }
      this.game.openTab(4);
      this.status = "Opening GUI...";
      this.dieScript = true;
      for (int i4 = 0; i4 < this.v.length; i4++) {
        this.v[i4] = (17 * i4);
      }

      this.gui = new FOGRunner.FOGRunnerGUI(this);

      this.status = "Loading FOG Reward Prices...";
      for (i4 = 0; (i4 < this.FOGItems.length) && 
        (this.gui.isVisible()); i4++)
      {
        this.FOGItems[i4].setPrice();
        if ((this.gui.isActive()) || (this.gui.isVisible())) {
          this.gui.itemPrices[i4].setText("" + this.FOGItems[i4].price);
          this.gui.itemRatios[i4].setText("" + this.FOGItems[i4].getRatio());
        }

      }

      if (this.gui.isVisible()) {
        int[] arrayOfInt1 = new int[this.FOGItemsP2P.length];
        for (int i5 = 0; i5 < arrayOfInt1.length; i5++) {
          arrayOfInt1[i5] = this.FOGItemsP2P[i5].getRatio();
        }
        int[] arrayOfInt2 = new int[this.FOGItemsF2P.length];
        for (int i6 = 0; i6 < arrayOfInt2.length; i6++) {
          arrayOfInt2[i6] = this.FOGItemsF2P[i6].getRatio();
        }

        for (i6 = 0; i6 < this.FOGItems.length; i6++) {
          if (this.FOGItems[i6].members) {
            if (this.FOGItems[i6].getRatio() >= maxInArray(arrayOfInt1)) {
              if (this.gui.isActive()) {
                this.gui.itemRatios[i6].setText("" + this.FOGItems[i6].getRatio() + " - P2P Best");

                this.gui.itemRatios[i6].setFont(new Font("SansSerif", 1, 12));

                this.gui.itemRatios[i6].setBounds(new Rectangle(new Point(435, this.v[i6] + 1), this.gui.itemRatios[i6].getPreferredSize()));
              }

              this.f2pItem = this.FOGItems[i6];
            }
          }
          else if (this.FOGItems[i6].getRatio() >= maxInArray(arrayOfInt2)) {
            if (this.gui.isActive()) {
              this.gui.itemRatios[i6].setText("" + this.FOGItems[i6].getRatio() + " - F2P Best");

              this.gui.itemRatios[i6].setFont(new Font("SansSerif", 1, 12));

              this.gui.itemRatios[i6].setBounds(new Rectangle(new Point(435, this.v[i6] + 1), this.gui.itemRatios[i6].getPreferredSize()));
            }

            this.p2pItem = this.FOGItems[i6];
          }
        }

      }

      while ((this.gui.isActive()) || (this.gui.isVisible())) {
        this.status = "Waiting for GUI...";
        sleep(50);
      }
    }

    if (!this.dieScript)
    {
      this.startTime = System.currentTimeMillis();
      this.seconds = 0L;
      this.minutes = 0L;
      this.hours = 0L;
      this.mouse.setSpeed(this.mouseSpeed);
      try
      {
        this.startTokens = this.inventory.getCount(true, new int[] { this.tokenID });
      }
      catch (NullPointerException localNullPointerException) {
      }
      this.nextPlace = 0;

      this.startAttackExp = this.skills.getCurrentExp(0);
      this.startStrengthExp = this.skills.getCurrentExp(2);
      this.startDefenceExp = this.skills.getCurrentExp(1);
      this.startMagicExp = this.skills.getCurrentExp(6);
      this.startRangeExp = this.skills.getCurrentExp(4);
      this.startConstitutionExp = this.skills.getCurrentExp(3);

      this.startAttackLevel = this.skills.getRealLevel(0);
      this.startStrengthLevel = this.skills.getRealLevel(2);
      this.startDefenceLevel = this.skills.getRealLevel(1);
      this.startMagicLevel = this.skills.getRealLevel(6);
      this.startRangeLevel = this.skills.getRealLevel(4);
      this.startConstitutionLevel = this.skills.getRealLevel(3);

      this.prayerlvl = this.skills.getRealLevel(5);

      if (this.teleorbLong.equals("When being Hunted"))
        this.teleorb = "hunted";
      else if (this.teleorbLong.equals("When Hunting"))
        this.teleorb = "hunting";
      else if (this.teleorbLong.equals("Random (Hunting/Hunted)"))
        this.teleorb = "random";
      else if (this.teleorbLong.equals("Never")) {
        this.teleorb = "never";
      }
      else if (this.dmode) {
        log("Tele-Orb Mode Error");
      }

      this.currentStyle = this.firstStyle;

      log(">>> FOGRUNNER STARTED <<<");
      this.status = "Equipping Items...";
      setupStyleEquipment();
      setupStyle();
    }

    this.initialised = true;
  }

  public void initialiseImages() {
    this.status = "Loading Images...";
    try {
      this.banner = ImageIO.read(this.bannerFile);
      this.success = true;
    } catch (FileNotFoundException localFileNotFoundException) {
      this.loadBannerFromFile = false;
    } catch (IOException localIOException1) {
      this.loadBannerFromFile = false;
    }
    if (!this.loadBannerFromFile) {
      try {
        URL localURL1 = new URL("http://i55.tinypic.com/288144x.png");

        this.banner = ImageIO.read(localURL1);
        this.success = true;
      } catch (MalformedURLException localMalformedURLException1) {
        log("Unable to buffer banner.");
      } catch (IOException localIOException2) {
        log("Unable to open banner image.");
      }
      if (this.success)
        try {
          ImageIO.write(this.banner, "png", this.bannerFile);
        } catch (IOException localIOException3) {
          log("Save Banner Image Failed");
        }
    }
    try
    {
      URL localURL2 = new URL("http://i54.tinypic.com/2unwz85.png");
      URL localURL3 = new URL("http://i51.tinypic.com/24y1lxe.png");
      URL localURL4 = new URL("http://i51.tinypic.com/16ge3no.png");
      URL localURL5 = new URL("http://i53.tinypic.com/2j49b0k.png");

      this.normal = ImageIO.read(localURL2);
      this.clicked = ImageIO.read(localURL3);
      this.upArrow = ImageIO.read(localURL4);
      this.downArrow = ImageIO.read(localURL5);
    } catch (MalformedURLException localMalformedURLException2) {
      log("Unable to buffer cursor.");
    } catch (IOException localIOException4) {
      log("Unable to open cursor image.");
    }
  }

  public double getVersion() {
    return 1.5D;
  }

  public final boolean onStart()
  {
    if (!this.game.isLoggedIn()) {
      this.env.enableRandom("Login");
      this.loginWait = true;
      this.status = "Logging in...";
      log(">>> GUI WILL OPEN AFTER LOGIN <<<");
    }

    this.initialised = false;
    return true;
  }

  public void onRepaint(Graphics paramGraphics)
  {
    Graphics2D localGraphics2D = (Graphics2D)paramGraphics;

    if ((inGame()) && 
      ((this.prevHg != -1) || (this.prevHd != -1)) && 
      (this.interfaces.get(730).getComponent(26).getBoundsArrayIndex() != -1) && (this.interfaces.get(730).getComponent(27).getBoundsArrayIndex() != -1))
    {
      if (this.round != 2) {
        this.canDrawTheirTile = false;
        this.antiBanTime = false;
        this.timerStarted = false;
        this.searchTileOn = 0;
        this.searching = false;
        this.stoneHovered = false;
        this.lastPrayerSet = 0;
        this.lastAttackPrayerSet = 0;
        this.lastSkinPrayerSet = -1;
        this.lastKnownLoc = new RSTile(-1, -1);
        this.timerToUse = 1;
        this.meleeTimerStarted = false;
        this.lastKnownHealth = 100;
        this.round = 2;
      }

    }

    this.runTime = (System.currentTimeMillis() - this.startTime);
    this.seconds = (this.runTime / 1000L);
    if (this.seconds >= 60L) {
      this.minutes = (this.seconds / 60L);
      this.seconds -= this.minutes * 60L;
    }
    if (this.minutes >= 60L) {
      this.hours = (this.minutes / 60L);
      this.minutes -= this.hours * 60L;
    }

    this.tokensGained = (this.currentTokens + this.bankedTokens - this.startTokens);
    this.tokensPerHour = (int)(3600000.0D / this.runTime * this.tokensGained);
    this.gamesPerHour = (int)(3600000.0D / this.runTime * this.gamesPlayed);
    this.gamesWonPerHour = (int)(3600000.0D / this.runTime * this.gamesWon);
    this.gamesLostPerHour = (int)(3600000.0D / this.runTime * this.gamesLost);
    int i = (int)(3600000.0D / this.runTime * this.gainedRating);
    try
    {
      drawTile(paramGraphics, getMyPlayer().getLocation(), new Color(0, 255, 0, 80), "You", new Color(0, 255, 0, 255));
    }
    catch (NullPointerException localNullPointerException1)
    {
    }

    if (this.canDrawTheirTile)
      try {
        if (getPlayerLocThrow().getX() != 0) {
          this.lastKnownLoc = getPlayerLocThrow();
          drawTile(paramGraphics, getPlayerLocThrow(), new Color(255, 0, 0, 80), "Opponent", new Color(255, 0, 0, 255));
        }
      }
      catch (NullPointerException localNullPointerException2) {
        this.canDrawTheirTile = false;
      }
    int n;
    if (this.clicked != null) {
      int j = (int)this.mouse.getLocation().getX();
      int k = (int)this.mouse.getLocation().getY();
      int m = (int)this.mouse.getPressLocation().getX();
      n = (int)this.mouse.getPressLocation().getY();
      long l = System.currentTimeMillis() - this.mouse.getPressTime();
      if (l < 1000L) {
        paramGraphics.setColor(Color.RED);
        paramGraphics.drawLine(m - 6, n, m - 2, n);
        paramGraphics.drawLine(m - 5, n - 1, m - 3, n - 1);
        paramGraphics.drawLine(m - 5, n + 1, m - 3, n + 1);
        paramGraphics.drawLine(m + 6, n, m + 2, n);
        paramGraphics.drawLine(m + 5, n - 1, m + 3, n - 1);
        paramGraphics.drawLine(m + 5, n + 1, m + 3, n + 1);
        paramGraphics.drawLine(m, n - 6, m, n - 2);
        paramGraphics.drawLine(m - 1, n - 5, m - 1, n - 3);
        paramGraphics.drawLine(m + 1, n - 5, m + 1, n - 3);
        paramGraphics.drawLine(m, n + 6, m, n + 2);
        paramGraphics.drawLine(m - 1, n + 5, m - 1, n + 3);
        paramGraphics.drawLine(m + 1, n + 5, m + 1, n + 3);
      }
      if ((this.mouse.getPressTime() == -1L) || (l >= 300L))
        paramGraphics.drawImage(this.normal, j - 10, k - 6, null);
      if (l < 300L) {
        paramGraphics.drawImage(this.clicked, j - 10, k - 6, null);
      }
    }
    Color localColor1 = new Color(255, 255, 255, (int)(255.0D * this.statusAlpha));

    if (this.statusPaint != 0) {
      if (this.statusPaint == 1) {
        if (this.statusAlpha < 1.0D)
          this.statusAlpha += 0.2D;
        else
          this.statusPaint = 2;
      }
      else if (this.statusPaint == 2)
        this.statusAlpha = 1.0D;
      else if (this.statusPaint == 3) {
        if (this.statusAlpha > 0.2D) {
          this.statusAlpha -= 0.2D;
        } else {
          this.statusAlpha = 0.0D;
          this.statusPaint = 0;
        }
      }

      localColor1 = new Color(255, 255, 255, (int)(255.0D * this.statusAlpha));

      paramGraphics.setColor(new Color(0, 0, 70, (int)(150.0D * this.statusAlpha)));
      paramGraphics.fillRoundRect(1, 301, 514, 37, this.cornerNum, this.cornerNum);
      paramGraphics.setColor(localColor1);
      paramGraphics.drawRoundRect(1, 301, 514, 37, this.cornerNum, this.cornerNum);
      paramGraphics.setFont(new Font("Arial", 1, 14));
      paramGraphics.drawString(this.properties.name() + " v" + getVersion(), 6, 316);
      paramGraphics.drawString("Status: ", 150, 316);
      paramGraphics.setFont(new Font("Arial", 0, 14));
      if (!this.overallStatus.equals("NULL"))
        paramGraphics.drawString(this.overallStatus + " | " + this.status, 205, 316);
      else
        paramGraphics.drawString(this.status, 205, 316);
      String str;
      if (this.dmode) {
        str = Integer.toString(this.interfaces.get(730).getComponent(26).getBoundsArrayIndex());

        localObject = Integer.toString(this.interfaces.get(730).getComponent(27).getBoundsArrayIndex());

        n = -1;
        if ((this.magic.getInterface() != null) && (this.magic.getInterface().isValid()))
        {
          n = this.magic.getInterface().getIndex();
        }
        paramGraphics.drawString("Magic ID: " + n + "  B.A.Is: Hunting: " + str + " Hunted: " + (String)localObject + "   User Mouse: " + this.userMouseX + ", " + this.userMouseY, 2, 299);
      }

      if ((inGame()) && 
        (this.canDrawInfo)) {
        try {
          if (this.dmode) {
            str = Integer.toString(getPlayerThrow().getAnimation());

            paramGraphics.drawString("OP Anim: " + str, 2, 287);
          }
          paramGraphics.drawString("Opponent LvL: " + getPlayerThrow().getCombatLevel(), 6, 331);

          drawHealthBar(paramGraphics, localGraphics2D, 150, 332);

          if ((this.hitSwitch) && 
            (inGame())) {
            if ((this.round == 1) && 
              (!this.hunted) && 
              (attacking())) {
              if (getPlayerThrow().getHPPercent() < this.lastKnownHealth) {
                this.lastKnownHealth = getPlayerThrow().getHPPercent();

                this.hits += 1;
              } else if (getPlayerThrow().getHPPercent() > this.lastKnownHealth)
              {
                this.lastKnownHealth = getPlayerThrow().getHPPercent();
              }

            }

            if ((this.round == 2) && 
              (!this.hunted2) && 
              (attacking())) {
              if (getPlayerThrow().getHPPercent() < this.lastKnownHealth) {
                this.lastKnownHealth = getPlayerThrow().getHPPercent();

                this.hits += 1;
              } else if (getPlayerThrow().getHPPercent() > this.lastKnownHealth)
              {
                this.lastKnownHealth = getPlayerThrow().getHPPercent();
              }
            }

          }

        }
        catch (NullPointerException localNullPointerException3)
        {
          this.canDrawInfo = false;
          if (this.dmode) {
            log("Null Error: " + localNullPointerException3);
            localNullPointerException3.printStackTrace();
          }
        }
      }

    }

    Color localColor2 = new Color(30, 30, 100, 255);
    Object localObject = new Color(60, 60, 130, 255);
    Color localColor3 = new Color(0, 0, 50, 255);
    Color localColor4 = new Color(20, 75, 20, 255);
    Color localColor5 = new Color(40, 95, 40, 255);
    Color localColor6 = new Color(0, 60, 0, 255);

    Color localColor7 = new Color(30, 30, 100, (int)(255.0D * this.statsAlpha));
    Color localColor8 = new Color(60, 60, 130, (int)(255.0D * this.statsAlpha));
    Color localColor9 = new Color(0, 0, 50, (int)(255.0D * this.statsAlpha));
    Color localColor10 = new Color(20, 75, 20, (int)(255.0D * this.statsAlpha));
    Color localColor11 = new Color(40, 95, 40, (int)(255.0D * this.statsAlpha));
    Color localColor12 = new Color(0, 60, 0, (int)(255.0D * this.statsAlpha));

    Color localColor13 = new Color(255, 255, 255, (int)(255.0D * this.statsAlpha));

    int[] arrayOfInt = { 199, 214, 229, 244, 259, 274, 289, 304, 319, 334, 349, 364, 379, 394, 409, 424, 439, 454, 469, 484 };

    if (this.statsPaint != 0) {
      if (this.statsPaint == 1) {
        if (this.statsAlpha < 1.0D)
          this.statsAlpha += 0.2D;
        else
          this.statsPaint = 2;
      }
      else if (this.statsPaint == 2)
        this.statsAlpha = 1.0D;
      else if (this.statsPaint == 3) {
        if (this.statsAlpha > 0.2D) {
          this.statsAlpha -= 0.2D;
        } else {
          this.statsAlpha = 0.0D;
          this.statsPaint = 0;
        }
      }

      localColor13 = new Color(255, 255, 255, (int)(255.0D * this.statsAlpha));

      if (this.moreStats == 0) {
        paramGraphics.setColor(new Color(0, 0, 70, (int)(110.0D * this.statsAlpha)));
        paramGraphics.fillRoundRect(555, 327, 175, 134, this.cornerNum, this.cornerNum);
        paramGraphics.setColor(new Color(255, 255, 255, (int)(255.0D * this.statsAlpha)));
        paramGraphics.drawRoundRect(555, 327, 175, 134, this.cornerNum, this.cornerNum);
        paramGraphics.setFont(new Font("Arial", 1, 14));
        paramGraphics.drawString(this.properties.name() + " v" + getVersion(), 561, arrayOfInt[9] + 8);

        paramGraphics.setFont(new Font("Arial", 0, 12));
        paramGraphics.drawString("Run Time: " + this.hours + ":" + this.minutes + ":" + this.seconds, 561, arrayOfInt[10] + 8);

        paramGraphics.setColor(new Color(200, 200, 200, (int)(255.0D * this.statsAlpha)));
        paramGraphics.drawString("-----------------------------------------", 561, arrayOfInt[11] + 3);

        paramGraphics.setColor(localColor13);
        paramGraphics.drawString("Tokens Gained: " + this.tokensGained, 561, arrayOfInt[12]);
        paramGraphics.drawString("Tokens/Hour: " + this.tokensPerHour, 561, arrayOfInt[13]);
        paramGraphics.drawString("Games Played: " + this.gamesPlayed, 561, arrayOfInt[14]);
        paramGraphics.drawString("Won: " + this.gamesWon + "  Lost: " + this.gamesLost + "  Ratio: " + getRatio(), 561, arrayOfInt[15]);
      }
      else {
        switch (this.moreStats) {
        case 1:
          if (this.moreStatsOffset < 120)
            this.moreStatsOffset += 5;
          else {
            this.moreStats = 2;
          }
          break;
        case 3:
          if (this.moreStatsOffset > 0)
            this.moreStatsOffset -= 5;
          else {
            this.moreStats = 0;
          }
        }

        paramGraphics.setColor(new Color(0, 0, 70, (int)(110.0D * this.statsAlpha)));
        paramGraphics.fillRoundRect(555, 327 - this.moreStatsOffset, 175, 134 + this.moreStatsOffset, this.cornerNum, this.cornerNum);

        paramGraphics.setColor(localColor13);
        paramGraphics.drawRoundRect(555, 327 - this.moreStatsOffset, 175, 134 + this.moreStatsOffset, this.cornerNum, this.cornerNum);

        paramGraphics.setFont(new Font("Arial", 1, 14));
        paramGraphics.drawString(this.properties.name() + " v" + getVersion(), 561, arrayOfInt[9] + 8 - this.moreStatsOffset);

        paramGraphics.setFont(new Font("Arial", 0, 12));
        paramGraphics.drawString("Run Time: " + this.hours + ":" + this.minutes + ":" + this.seconds, 561, arrayOfInt[10] + 8 - this.moreStatsOffset);

        paramGraphics.setColor(new Color(200, 200, 200, (int)(255.0D * this.statsAlpha)));
        paramGraphics.drawString("-----------------------------------------", 561, arrayOfInt[11] + 3 - this.moreStatsOffset);

        paramGraphics.setColor(localColor13);
        paramGraphics.drawString("Tokens Gained: " + this.tokensGained, 561, arrayOfInt[12] - this.moreStatsOffset);

        paramGraphics.drawString("Tokens/Hour: " + this.tokensPerHour, 561, arrayOfInt[13] - this.moreStatsOffset);

        paramGraphics.drawString("Games Played: " + this.gamesPlayed, 561, arrayOfInt[14] - this.moreStatsOffset);

        paramGraphics.drawString("Won: " + this.gamesWon + "  Lost: " + this.gamesLost + "  Ratio: " + getRatio(), 561, arrayOfInt[15] - this.moreStatsOffset);

        if (this.moreStatsOffset >= 115) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[0] < 1.0D)) {
            this.textAlpha[0] += 0.2D;
          }

          if (((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[0] > 0.0D)) {
            this.textAlpha[0] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(0)));
          paramGraphics.drawString("Games/Hour: " + this.gamesPerHour, 561, arrayOfInt[8]);
        }
        if (this.moreStatsOffset >= 105) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[1] < 1.0D)) {
            this.textAlpha[1] += 0.2D;
          }

          if ((this.moreStatsOffset <= 115) && 
            ((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[1] > 0.0D)) {
            this.textAlpha[1] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(1)));
          paramGraphics.drawString("Wins/H: " + this.gamesWonPerHour + "  " + "Losses/H: " + this.gamesLostPerHour, 561, arrayOfInt[9]);
        }

        if (this.moreStatsOffset >= 90) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[2] < 1.0D)) {
            this.textAlpha[2] += 0.2D;
          }

          if ((this.moreStatsOffset <= 105) && 
            ((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[2] > 0.0D)) {
            this.textAlpha[2] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(2)));
          paramGraphics.drawString("% Games Won: " + (int)(getRatio2() * 100.0D) + "%", 561, arrayOfInt[10]);
        }

        if (this.moreStatsOffset >= 75) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[3] < 1.0D)) {
            this.textAlpha[3] += 0.2D;
          }

          if ((this.moreStatsOffset <= 90) && 
            ((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[3] > 0.0D)) {
            this.textAlpha[3] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(3)));
          paramGraphics.drawString("Average Charges: " + this.averageCharges, 561, arrayOfInt[11]);
        }

        if (this.moreStatsOffset >= 60) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[4] < 1.0D)) {
            this.textAlpha[4] += 0.2D;
          }

          if ((this.moreStatsOffset <= 75) && 
            ((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[4] > 0.0D)) {
            this.textAlpha[4] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(4)));
          paramGraphics.drawString("Average Op. Charges: " + this.averageChargesOpponent, 561, arrayOfInt[12]);
        }

        if (this.moreStatsOffset >= 45) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[5] < 1.0D)) {
            this.textAlpha[5] += 0.2D;
          }

          if ((this.moreStatsOffset <= 60) && 
            ((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[5] > 0.0D)) {
            this.textAlpha[5] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(5)));
          paramGraphics.drawString("Current Rating: " + this.currentRating, 561, arrayOfInt[13]);
        }

        if (this.moreStatsOffset >= 30) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[6] < 1.0D)) {
            this.textAlpha[6] += 0.2D;
          }

          if ((this.moreStatsOffset <= 45) && 
            ((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[6] > 0.0D)) {
            this.textAlpha[6] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(6)));
          paramGraphics.drawString("Gained Rating: " + this.gainedRating, 561, arrayOfInt[14]);
        }

        if (this.moreStatsOffset >= 15) {
          if (((this.moreStats == 1) || (this.moreStats == 2)) && 
            (this.textAlpha[7] < 1.0D)) {
            this.textAlpha[7] += 0.2D;
          }

          if ((this.moreStatsOffset <= 30) && 
            ((this.moreStats == 3) || (this.moreStats == 0)) && 
            (this.textAlpha[7] > 0.0D)) {
            this.textAlpha[7] -= 0.2D;
          }

          paramGraphics.setColor(new Color(255, 255, 255, getTextAlpha(7)));
          paramGraphics.drawString("Rating/Hour: " + i, 561, arrayOfInt[15]);
        }
      }

    }

    Color localColor14 = new Color(255, 255, 255, (int)(255.0D * this.expAlpha));

    if ((this.game.isLoggedIn()) && (this.initialised) && (this.expPaint != 0)) {
      if (this.expPaint == 1) {
        if (this.expAlpha < 1.0D)
          this.expAlpha += 0.2D;
        else
          this.expPaint = 2;
      }
      else if (this.expPaint == 2)
        this.expAlpha = 1.0D;
      else if (this.expPaint == 3) {
        if (this.expAlpha > 0.2D) {
          this.expAlpha -= 0.2D;
        } else {
          this.expAlpha = 0.0D;
          this.expPaint = 0;
        }
      }

      localColor14 = new Color(255, 255, 255, (int)(255.0D * this.expAlpha));

      int i1 = this.skills.getCurrentExp(0) - this.startAttackExp;

      int i2 = this.skills.getCurrentExp(2) - this.startStrengthExp;

      int i3 = this.skills.getCurrentExp(1) - this.startDefenceExp;

      int i4 = this.skills.getCurrentExp(6) - this.startMagicExp;

      int i5 = this.skills.getCurrentExp(4) - this.startRangeExp;

      int i6 = this.skills.getCurrentExp(3) - this.startConstitutionExp;

      int i7 = (int)(3600000.0D / this.runTime * i1);
      int i8 = (int)(3600000.0D / this.runTime * i2);
      int i9 = (int)(3600000.0D / this.runTime * i3);
      int i10 = (int)(3600000.0D / this.runTime * i4);
      int i11 = (int)(3600000.0D / this.runTime * i5);
      int i12 = (int)(3600000.0D / this.runTime * i6);

      int i13 = this.skills.getRealLevel(0) - this.startAttackLevel;

      int i14 = this.skills.getRealLevel(2) - this.startStrengthLevel;

      int i15 = this.skills.getRealLevel(1) - this.startDefenceLevel;

      int i16 = this.skills.getRealLevel(6) - this.startMagicLevel;

      int i17 = this.skills.getRealLevel(4) - this.startRangeLevel;

      int i18 = this.skills.getRealLevel(3) - this.startConstitutionLevel;

      Color localColor15 = new Color(0, 0, 0, (int)(200.0D * this.expAlpha));
      Color localColor16 = new Color(0, 0, 0, 0);
      this.expGradientBox.y = this.expYs[this.nextPlace];
      GradientPaint localGradientPaint = new GradientPaint(this.expGradientBox.x, this.expGradientBox.y, localColor15, this.expGradientBox.x, this.expGradientBox.y + this.expGradientBox.height, localColor16, false);

      localGraphics2D.setPaint(localGradientPaint);
      localGraphics2D.fillRect(this.expGradientBox.x, this.expGradientBox.y, this.expGradientBox.width, this.expGradientBox.height);

      Color localColor17 = new Color(70, 70, 70, (int)(255.0D * this.expAlpha));
      Color localColor18 = new Color(40, 40, 40, (int)(255.0D * this.expAlpha));
      Color localColor19 = new Color(0, 0, 0, (int)(255.0D * this.expAlpha));
      Color localColor20 = new Color(0, 0, 150, (int)(255.0D * this.expAlpha));
      Color localColor21 = new Color(75, 45, 0, (int)(255.0D * this.expAlpha));
      Color localColor22 = new Color(150, 0, 0, (int)(255.0D * this.expAlpha));
      Color localColor23 = new Color(0, 255, 0, (int)(255.0D * this.expAlpha));
      Color localColor24 = new Color(255, 0, 0, (int)(255.0D * this.expAlpha));

      if (i1 > 0) {
        if (this.attackBox.y == 0) {
          this.attackBox.y = this.expYs[this.nextPlace];
          this.nextPlace += 1;
        }
        paramGraphics.setColor(localColor19);
        paramGraphics.fillRoundRect(this.attackBox.x, this.attackBox.y, this.attackBox.width, this.attackBox.height, 0, 0);

        paramGraphics.setColor(localColor14);
        paramGraphics.setFont(new Font("Arial", 1, 11));
        paramGraphics.drawString("Attack", this.attackBox.x + 3, this.attackBox.y + 10);
        paramGraphics.setFont(new Font("Arial", 0, 11));
        paramGraphics.drawString("XP Gained: " + i1, this.attackBox.x + 77, this.attackBox.y + 10);

        paramGraphics.drawString("XP/Hour: " + i7, this.attackBox.x + 183, this.attackBox.y + 10);

        paramGraphics.drawString("Level: " + this.skills.getRealLevel(0) + "(+" + i13 + ")", this.attackBox.x + 268, this.attackBox.y + 10);

        if (this.skills.getRealLevel(0) < 99) {
          paramGraphics.drawString("% to " + (this.skills.getRealLevel(0) + 1) + ":", this.attackBox.x + 343, this.attackBox.y + 10);

          drawPercentBar(paramGraphics, localGraphics2D, this.attackBox.x + 385, this.attackBox.y + 1, this.attackBox.height - 3, localColor19, localColor14, localColor23, localColor24, this.skills.getPercentToNextLevel(0));
        }

      }

      if (i2 > 0) {
        if (this.strengthBox.y == 0) {
          this.strengthBox.y = this.expYs[this.nextPlace];
          this.nextPlace += 1;
        }
        paramGraphics.setColor(localColor18);
        paramGraphics.fillRoundRect(this.strengthBox.x, this.strengthBox.y, this.strengthBox.width, this.strengthBox.height, 0, 0);

        paramGraphics.setColor(localColor14);
        paramGraphics.setFont(new Font("Arial", 1, 11));
        paramGraphics.drawString("Strength", this.strengthBox.x + 3, this.strengthBox.y + 10);
        paramGraphics.setFont(new Font("Arial", 0, 11));
        paramGraphics.drawString("XP Gained: " + i2, this.strengthBox.x + 77, this.strengthBox.y + 10);

        paramGraphics.drawString("XP/Hour: " + i8, this.strengthBox.x + 183, this.strengthBox.y + 10);

        paramGraphics.drawString("Level: " + this.skills.getRealLevel(2) + "(+" + i14 + ")", this.strengthBox.x + 268, this.strengthBox.y + 10);

        if (this.skills.getRealLevel(2) < 99) {
          paramGraphics.drawString("% to " + (this.skills.getRealLevel(2) + 1) + ":", this.strengthBox.x + 343, this.strengthBox.y + 10);

          drawPercentBar(paramGraphics, localGraphics2D, this.strengthBox.x + 385, this.strengthBox.y + 1, this.strengthBox.height - 3, localColor19, localColor14, localColor23, localColor24, this.skills.getPercentToNextLevel(2));
        }

      }

      if (i3 > 0) {
        if (this.defenceBox.y == 0) {
          this.defenceBox.y = this.expYs[this.nextPlace];
          this.nextPlace += 1;
        }
        paramGraphics.setColor(localColor17);
        paramGraphics.fillRoundRect(this.defenceBox.x, this.defenceBox.y, this.defenceBox.width, this.defenceBox.height, 0, 0);

        paramGraphics.setColor(localColor14);
        paramGraphics.setFont(new Font("Arial", 1, 11));
        paramGraphics.drawString("Defence", this.defenceBox.x + 3, this.defenceBox.y + 10);
        paramGraphics.setFont(new Font("Arial", 0, 11));
        paramGraphics.drawString("XP Gained: " + i3, this.defenceBox.x + 77, this.defenceBox.y + 10);

        paramGraphics.drawString("XP/Hour: " + i9, this.defenceBox.x + 183, this.defenceBox.y + 10);

        paramGraphics.drawString("Level: " + this.skills.getRealLevel(1) + "(+" + i15 + ")", this.defenceBox.x + 268, this.defenceBox.y + 10);

        if (this.skills.getRealLevel(1) < 99) {
          paramGraphics.drawString("% to " + (this.skills.getRealLevel(1) + 1) + ":", this.defenceBox.x + 343, this.defenceBox.y + 10);

          drawPercentBar(paramGraphics, localGraphics2D, this.defenceBox.x + 385, this.defenceBox.y + 1, this.defenceBox.height - 3, localColor19, localColor14, localColor23, localColor24, this.skills.getPercentToNextLevel(1));
        }

      }

      if (i4 > 0) {
        if (this.magicBox.y == 0) {
          this.magicBox.y = this.expYs[this.nextPlace];
          this.nextPlace += 1;
        }
        paramGraphics.setColor(localColor20);
        paramGraphics.fillRoundRect(this.magicBox.x, this.magicBox.y, this.magicBox.width, this.magicBox.height, 0, 0);

        paramGraphics.setColor(localColor14);
        paramGraphics.setFont(new Font("Arial", 1, 11));
        paramGraphics.drawString("Magic", this.magicBox.x + 3, this.magicBox.y + 10);
        paramGraphics.setFont(new Font("Arial", 0, 11));
        paramGraphics.drawString("XP Gained: " + i4, this.magicBox.x + 77, this.magicBox.y + 10);

        paramGraphics.drawString("XP/Hour: " + i10, this.magicBox.x + 183, this.magicBox.y + 10);

        paramGraphics.drawString("Level: " + this.skills.getRealLevel(6) + "(+" + i16 + ")", this.magicBox.x + 268, this.magicBox.y + 10);

        if (this.skills.getRealLevel(6) < 99) {
          paramGraphics.drawString("% to " + (this.skills.getRealLevel(6) + 1) + ":", this.magicBox.x + 343, this.magicBox.y + 10);

          drawPercentBar(paramGraphics, localGraphics2D, this.magicBox.x + 385, this.magicBox.y + 1, this.magicBox.height - 3, localColor19, localColor14, localColor23, localColor24, this.skills.getPercentToNextLevel(6));
        }

      }

      if (i5 > 0) {
        if (this.rangeBox.y == 0) {
          this.rangeBox.y = this.expYs[this.nextPlace];
          this.nextPlace += 1;
        }
        paramGraphics.setColor(localColor21);
        paramGraphics.fillRoundRect(this.rangeBox.x, this.rangeBox.y, this.rangeBox.width, this.rangeBox.height, 0, 0);

        paramGraphics.setColor(localColor14);
        paramGraphics.setFont(new Font("Arial", 1, 11));
        paramGraphics.drawString("Range", this.rangeBox.x + 3, this.rangeBox.y + 10);
        paramGraphics.setFont(new Font("Arial", 0, 11));
        paramGraphics.drawString("XP Gained: " + i5, this.rangeBox.x + 77, this.rangeBox.y + 10);

        paramGraphics.drawString("XP/Hour: " + i11, this.rangeBox.x + 183, this.rangeBox.y + 10);

        paramGraphics.drawString("Level: " + this.skills.getRealLevel(4) + "(+" + i17 + ")", this.rangeBox.x + 268, this.rangeBox.y + 10);

        if (this.skills.getRealLevel(4) < 99) {
          paramGraphics.drawString("% to " + (this.skills.getRealLevel(4) + 1) + ":", this.rangeBox.x + 343, this.rangeBox.y + 10);

          drawPercentBar(paramGraphics, localGraphics2D, this.rangeBox.x + 385, this.rangeBox.y + 1, this.rangeBox.height - 3, localColor19, localColor14, localColor23, localColor24, this.skills.getPercentToNextLevel(4));
        }

      }

      if (i6 > 0) {
        if (this.constitutionBox.y == 0) {
          this.constitutionBox.y = this.expYs[this.nextPlace];
          this.nextPlace += 1;
        }
        paramGraphics.setColor(localColor22);
        paramGraphics.fillRoundRect(this.constitutionBox.x, this.constitutionBox.y, this.constitutionBox.width, this.constitutionBox.height, 0, 0);

        paramGraphics.setColor(localColor14);
        paramGraphics.setFont(new Font("Arial", 1, 11));
        paramGraphics.drawString("Constitution", this.constitutionBox.x + 3, this.constitutionBox.y + 10);

        paramGraphics.setFont(new Font("Arial", 0, 11));
        paramGraphics.drawString("XP Gained: " + i6, this.constitutionBox.x + 77, this.constitutionBox.y + 10);

        paramGraphics.drawString("XP/Hour: " + i12, this.constitutionBox.x + 183, this.constitutionBox.y + 10);

        paramGraphics.drawString("Level: " + this.skills.getRealLevel(3) + "(+" + i18 + ")", this.constitutionBox.x + 268, this.constitutionBox.y + 10);

        if (this.skills.getRealLevel(3) < 99) {
          paramGraphics.drawString("% to " + (this.skills.getRealLevel(3) + 1) + ":", this.constitutionBox.x + 343, this.constitutionBox.y + 10);

          drawPercentBar(paramGraphics, localGraphics2D, this.constitutionBox.x + 385, this.constitutionBox.y + 1, this.constitutionBox.height - 3, localColor19, localColor14, localColor23, localColor24, this.skills.getPercentToNextLevel(3));
        }

      }

      if ((i1 > 0) && 
        (mouseInArea(this.attackBox))) {
        drawExpInfo(paramGraphics, localGraphics2D, localColor19, localColor14, localColor19, localColor23, localColor24, "Attack", 0, i1, i13);
      }

      if ((i2 > 0) && 
        (mouseInArea(this.strengthBox))) {
        drawExpInfo(paramGraphics, localGraphics2D, localColor19, localColor14, localColor18, localColor23, localColor24, "Strength", 2, i2, i14);
      }

      if ((i3 > 0) && 
        (mouseInArea(this.defenceBox))) {
        drawExpInfo(paramGraphics, localGraphics2D, localColor19, localColor14, localColor17, localColor23, localColor24, "Defence", 1, i3, i15);
      }

      if ((i4 > 0) && 
        (mouseInArea(this.magicBox))) {
        drawExpInfo(paramGraphics, localGraphics2D, localColor19, localColor14, localColor20, localColor23, localColor24, "Magic", 6, i4, i16);
      }

      if ((i5 > 0) && 
        (mouseInArea(this.rangeBox))) {
        drawExpInfo(paramGraphics, localGraphics2D, localColor19, localColor14, localColor21, localColor23, localColor24, "Range", 4, i5, i17);
      }

      if ((i6 > 0) && 
        (mouseInArea(this.constitutionBox))) {
        drawExpInfo(paramGraphics, localGraphics2D, localColor19, localColor14, localColor22, localColor23, localColor24, "Constitution", 3, i6, i18);
      }

    }

    if ((this.statusPaint == 1) || (this.statusPaint == 2)) {
      if (mouseInArea(this.statusButtonRec)) {
        if (this.userMousePressed) {
          drawButton(paramGraphics, this.statusButtonRec, localColor6, "Status", Color.WHITE);
        }
        else {
          drawButton(paramGraphics, this.statusButtonRec, localColor5, "Status", Color.WHITE);
        }
      }
      else {
        drawButton(paramGraphics, this.statusButtonRec, localColor4, "Status", Color.WHITE);
      }

    }
    else if (mouseInArea(this.statusButtonRec)) {
      if (this.userMousePressed) {
        drawButton(paramGraphics, this.statusButtonRec, localColor3, "Status", Color.WHITE);
      }
      else {
        drawButton(paramGraphics, this.statusButtonRec, (Color)localObject, "Status", Color.WHITE);
      }
    }
    else {
      drawButton(paramGraphics, this.statusButtonRec, localColor2, "Status", Color.WHITE);
    }

    if ((this.expPaint == 1) || (this.expPaint == 2)) {
      if (mouseInArea(this.expButtonRec)) {
        if (this.userMousePressed) {
          drawButton(paramGraphics, this.expButtonRec, localColor6, "Exp", Color.WHITE);
        }
        else {
          drawButton(paramGraphics, this.expButtonRec, localColor5, "Exp", Color.WHITE);
        }
      }
      else {
        drawButton(paramGraphics, this.expButtonRec, localColor4, "Exp", Color.WHITE);
      }
    }
    else if (mouseInArea(this.expButtonRec)) {
      if (this.userMousePressed) {
        drawButton(paramGraphics, this.expButtonRec, localColor3, "Exp", Color.WHITE);
      }
      else
        drawButton(paramGraphics, this.expButtonRec, (Color)localObject, "Exp", Color.WHITE);
    }
    else {
      drawButton(paramGraphics, this.expButtonRec, localColor2, "Exp", Color.WHITE);
    }

    if ((this.statsPaint == 1) || (this.statsPaint == 2)) {
      if (mouseInArea(this.statsButtonRec)) {
        if (this.userMousePressed) {
          drawButton(paramGraphics, this.statsButtonRec, localColor6, "Stats", Color.WHITE);
        }
        else {
          drawButton(paramGraphics, this.statsButtonRec, localColor5, "Stats", Color.WHITE);
        }
      }
      else {
        drawButton(paramGraphics, this.statsButtonRec, localColor4, "Stats", Color.WHITE);
      }

    }
    else if (mouseInArea(this.statsButtonRec)) {
      if (this.userMousePressed) {
        drawButton(paramGraphics, this.statsButtonRec, localColor3, "Stats", Color.WHITE);
      }
      else {
        drawButton(paramGraphics, this.statsButtonRec, (Color)localObject, "Stats", Color.WHITE);
      }
    }
    else {
      drawButton(paramGraphics, this.statsButtonRec, localColor2, "Stats", Color.WHITE);
    }

    if ((this.statsPaint == 1) || (this.statsPaint == 2) || (this.statsPaint == 3))
      if ((this.moreStats == 1) || (this.moreStats == 2)) {
        if (mouseInArea(this.moreStatsButtonRec)) {
          if (this.userMousePressed) {
            drawButton(paramGraphics, this.moreStatsButtonRec, localColor12, "Less", localColor13, -1, localColor13);
          }
          else {
            drawButton(paramGraphics, this.moreStatsButtonRec, localColor11, "Less", localColor13, -1, localColor13);
          }
        }
        else {
          drawButton(paramGraphics, this.moreStatsButtonRec, localColor10, "Less", localColor13, -1, localColor13);
        }

        if ((this.downArrow != null) && 
          (this.statsAlpha > 0.5D)) {
          paramGraphics.drawImage(this.downArrow, this.moreStatsButtonRec.x + 4, this.moreStatsButtonRec.y + 3, null);

          paramGraphics.drawImage(this.downArrow, this.moreStatsButtonRec.x + this.moreStatsButtonRec.width - this.downArrow.getWidth() - 4, this.moreStatsButtonRec.y + 3, null);
        }

      }
      else if ((this.moreStats == 0) || (this.moreStats == 3)) {
        if (mouseInArea(this.moreStatsButtonRec)) {
          if (this.userMousePressed) {
            drawButton(paramGraphics, this.moreStatsButtonRec, localColor9, "More", localColor13, -1, localColor13);
          }
          else {
            drawButton(paramGraphics, this.moreStatsButtonRec, localColor8, "More", localColor13, -1, localColor13);
          }
        }
        else {
          drawButton(paramGraphics, this.moreStatsButtonRec, localColor7, "More", localColor13, -1, localColor13);
        }

        if ((this.downArrow != null) && 
          (this.statsAlpha > 0.5D)) {
          paramGraphics.drawImage(this.upArrow, this.moreStatsButtonRec.x + 4, this.moreStatsButtonRec.y + 3, null);

          paramGraphics.drawImage(this.upArrow, this.moreStatsButtonRec.x + this.moreStatsButtonRec.width - this.upArrow.getWidth() - 4, this.moreStatsButtonRec.y + 3, null);
        }
      }
  }

  public int getTTLSecs(int paramInt1, int paramInt2)
  {
    int i = (int)(this.skills.getExpToNextLevel(paramInt1) / (1000.0D / this.runTime * paramInt2));
    if (i >= 60) {
      int j = i / 60;
      i -= j * 60;
    }
    return i;
  }

  public int getTTLMins(int paramInt1, int paramInt2) {
    int i = 0;
    int j = (int)(this.skills.getExpToNextLevel(paramInt1) / (1000.0D / this.runTime * paramInt2));
    if (j >= 60) {
      i = j / 60;
      j -= i * 60;
    }
    if (i >= 60) {
      int k = i / 60;
      i -= k * 60;
    }
    return i;
  }

  public int getTTLHours(int paramInt1, int paramInt2) {
    int i = 0;
    int j = 0;
    int k = (int)(this.skills.getExpToNextLevel(paramInt1) / (1000.0D / this.runTime * paramInt2));
    if (k >= 60) {
      j = k / 60;
      k -= j * 60;
    }
    if (j >= 60) {
      i = j / 60;
      j -= i * 60;
    }
    return i;
  }

  public String getTTL(int paramInt1, int paramInt2) {
    return "" + getTTLHours(paramInt1, paramInt2) + ":" + getTTLMins(paramInt1, paramInt2) + ":" + getTTLSecs(paramInt1, paramInt2);
  }

  public int getTextAlpha(int paramInt)
  {
    return (int)((int)(this.textAlpha[paramInt] * 255.0D) * this.statsAlpha);
  }

  public void drawPercentBar(Graphics paramGraphics, Graphics2D paramGraphics2D, int paramInt1, int paramInt2, int paramInt3, Color paramColor1, Color paramColor2, Color paramColor3, Color paramColor4, int paramInt4)
  {
    paramGraphics.setColor(paramColor4);
    paramGraphics.fillRoundRect(paramInt1, paramInt2, 100, paramInt3, 11, 11);
    paramGraphics.setColor(paramColor3);
    paramGraphics.fillRoundRect(paramInt1, paramInt2, paramInt4, paramInt3, 11, 11);
    GradientPaint localGradientPaint = new GradientPaint(paramInt1, paramInt2, paramColor2, paramInt1, paramInt2 + (int)(paramInt3 / 1.5D), new Color(255, 255, 255, 0), false);

    paramGraphics2D.setPaint(localGradientPaint);
    paramGraphics2D.fillRoundRect(paramInt1, paramInt2, 100, paramInt3, 11, 11);
    paramGraphics.setColor(paramColor1);
    paramGraphics.setFont(new Font("Arial", 0, 10));
    paramGraphics.drawString("" + paramInt4 + "%", paramInt1 + 10, paramInt2 + paramInt3 - 1);
    paramGraphics.drawRoundRect(paramInt1, paramInt2, 100, paramInt3, 11, 11);
    paramGraphics.drawRoundRect(paramInt1, paramInt2, paramInt4, paramInt3, 11, 11);
  }

  public void drawExpInfo(Graphics paramGraphics, Graphics2D paramGraphics2D, Color paramColor1, Color paramColor2, Color paramColor3, Color paramColor4, Color paramColor5, String paramString, int paramInt1, int paramInt2, int paramInt3)
  {
    int i = this.userMouseX;
    int j = this.userMouseY - 112;
    int k = 130;
    int m = this.userMouseY - j;
    int[] arrayOfInt = { 3, 15, 27, 39, 51, 63, 75, 87, 99 };
    for (int n = 0; n < arrayOfInt.length; n++) {
      arrayOfInt[n] = (arrayOfInt[n] + j + 9);
    }
    for (n = 1; n < arrayOfInt.length; n++) {
      arrayOfInt[n] += 1;
    }
    n = i + 5;
    int i1 = (int)(3600000.0D / this.runTime * paramInt2);
    paramGraphics.setColor(paramColor3);
    paramGraphics.fillRoundRect(i, j, k, m, this.cornerNum, this.cornerNum);
    GradientPaint localGradientPaint = new GradientPaint(i, j, paramColor2, i, j + 7, new Color(255, 255, 255, 0), false);

    paramGraphics2D.setPaint(localGradientPaint);
    paramGraphics2D.fillRoundRect(i, j, k, m, this.cornerNum, this.cornerNum);
    paramGraphics.setColor(paramColor1);
    paramGraphics.drawRoundRect(i, j, k, m, this.cornerNum, this.cornerNum);
    paramGraphics.setColor(paramColor2);
    Font localFont = new Font("Arial", 1, 10);
    FontMetrics localFontMetrics = paramGraphics.getFontMetrics(localFont);
    int i2 = localFontMetrics.stringWidth(paramString);
    int i3 = i + (k / 2 - i2 / 2);
    paramGraphics.setFont(localFont);
    paramGraphics.drawString(paramString, i3, arrayOfInt[0]);
    paramGraphics.drawString("Current XP: " + this.skills.getCurrentExp(paramInt1), n, arrayOfInt[1]);
    paramGraphics.drawString("Gained XP: " + paramInt2, n, arrayOfInt[2]);
    paramGraphics.drawString("XP/Hour: " + i1, n, arrayOfInt[3]);
    paramGraphics.drawString("Current LvL: " + this.skills.getRealLevel(paramInt1), n, arrayOfInt[4]);
    paramGraphics.drawString("Gained LvLs: " + paramInt3, n, arrayOfInt[5]);
    paramGraphics.drawString("XP to LvL: " + this.skills.getExpToNextLevel(paramInt1), n, arrayOfInt[6]);

    paramGraphics.drawString("TTL: " + getTTL(paramInt1, paramInt2), n, arrayOfInt[7]);
    int i4 = i + (k / 2 - 50);
    drawPercentBar(paramGraphics, paramGraphics2D, i4, arrayOfInt[8] - 9, 10, paramColor1, paramColor2, paramColor4, paramColor5, this.skills.getPercentToNextLevel(paramInt1));
  }

  public void drawButton(Graphics paramGraphics, Rectangle paramRectangle, Color paramColor1, String paramString, Color paramColor2)
  {
    drawButton(paramGraphics, paramRectangle, paramColor1, paramString, paramColor2, 0, Color.WHITE);
  }

  public void drawButton(Graphics paramGraphics, Rectangle paramRectangle, Color paramColor1, String paramString, Color paramColor2, int paramInt)
  {
    drawButton(paramGraphics, paramRectangle, paramColor1, paramString, paramColor2, paramInt, Color.WHITE);
  }

  public void drawButton(Graphics paramGraphics, Rectangle paramRectangle, Color paramColor1, String paramString, Color paramColor2, int paramInt, Color paramColor3)
  {
    paramGraphics.setColor(paramColor1);
    paramGraphics.fillRoundRect(paramRectangle.x, paramRectangle.y, paramRectangle.width, paramRectangle.height, 8, 8);
    paramGraphics.setColor(paramColor3);
    paramGraphics.drawRoundRect(paramRectangle.x, paramRectangle.y, paramRectangle.width, paramRectangle.height, 8, 8);
    paramGraphics.setColor(paramColor2);
    Font localFont = new Font("Arial", 0, 12);
    FontMetrics localFontMetrics = paramGraphics.getFontMetrics(localFont);
    int i = localFontMetrics.stringWidth(paramString);
    int j = paramRectangle.x + (paramRectangle.width / 2 - i / 2);
    paramGraphics.setFont(localFont);
    paramGraphics.drawString(paramString, j, paramRectangle.y + 12 + paramInt);
  }

  public void drawHealthBarHunted(Graphics paramGraphics, Graphics2D paramGraphics2D, int paramInt1, int paramInt2) throws NullPointerException
  {
    paramGraphics.setFont(new Font("Arial", 0, 14));
    paramGraphics.setColor(new Color(255, 255, 255, (int)(255.0D * this.statusAlpha)));
    paramGraphics.drawString("Your Health: ", paramInt1, paramInt2);
    paramGraphics.setFont(new Font("Arial", 0, 10));
    GradientPaint localGradientPaint;
    if (this.status.equals("Dying...")) {
      paramGraphics.setColor(new Color(255, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.fillRoundRect(paramInt1 + 100, paramInt2 - 10, 200, 10, 11, 11);
      localGradientPaint = new GradientPaint(paramInt1 + 100, paramInt2 - 10, new Color(255, 255, 255, (int)(255.0D * this.statusAlpha)), paramInt1 + 100, paramInt2 + 6 - 10, new Color(255, 255, 255, 0), false);

      paramGraphics2D.setPaint(localGradientPaint);
      paramGraphics2D.fillRoundRect(paramInt1 + 100, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.setColor(new Color(0, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.drawString("0%", paramInt1 + 115, paramInt2 - 1);
      paramGraphics.drawRoundRect(paramInt1 + 100, paramInt2 - 10, 200, 10, 11, 11);
    } else {
      paramGraphics.setColor(new Color(255, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.fillRoundRect(paramInt1 + 100, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.setColor(new Color(0, 255, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.fillRoundRect(paramInt1 + 100, paramInt2 - 10, getMyPlayer().getHPPercent() * 2, 10, 11, 11);

      localGradientPaint = new GradientPaint(paramInt1 + 100, paramInt2 - 10, new Color(255, 255, 255, (int)(255.0D * this.statusAlpha)), paramInt1 + 100, paramInt2 + 6 - 10, new Color(255, 255, 255, 0), false);

      paramGraphics2D.setPaint(localGradientPaint);
      paramGraphics2D.fillRoundRect(paramInt1 + 100, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.setColor(new Color(0, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.drawString("" + getMyPlayer().getHPPercent() + "%", paramInt1 + 115, paramInt2 - 1);

      paramGraphics.drawRoundRect(paramInt1 + 100, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.drawRoundRect(paramInt1 + 100, paramInt2 - 10, getMyPlayer().getHPPercent() * 2, 10, 11, 11);
    }
  }

  public void drawHealthBarHunting(Graphics paramGraphics, Graphics2D paramGraphics2D, int paramInt1, int paramInt2)
    throws NullPointerException
  {
    paramGraphics.setFont(new Font("Arial", 0, 14));
    paramGraphics.setColor(new Color(255, 255, 255, (int)(255.0D * this.statusAlpha)));
    paramGraphics.drawString("Opponent's Health: ", paramInt1, paramInt2);
    paramGraphics.setFont(new Font("Arial", 0, 10));
    GradientPaint localGradientPaint;
    if (this.status.equals("Opponent Killed")) {
      paramGraphics.setColor(new Color(255, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.fillRoundRect(paramInt1 + 130, paramInt2 - 10, 200, 10, 11, 11);
      localGradientPaint = new GradientPaint(paramInt1 + 130, paramInt2 - 10, new Color(255, 255, 255, (int)(255.0D * this.statusAlpha)), paramInt1 + 130, paramInt2 + 6 - 10, new Color(255, 255, 255, 0), false);

      paramGraphics2D.setPaint(localGradientPaint);
      paramGraphics2D.fillRoundRect(paramInt1 + 130, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.setColor(new Color(0, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.drawString("0%", paramInt1 + 145, paramInt2 - 1);
      paramGraphics.drawRoundRect(paramInt1 + 130, paramInt2 - 10, 200, 10, 11, 11);
    } else {
      paramGraphics.setColor(new Color(255, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.fillRoundRect(paramInt1 + 130, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.setColor(new Color(0, 255, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.fillRoundRect(paramInt1 + 130, paramInt2 - 10, getPlayerThrow().getHPPercent() * 2, 10, 11, 11);

      localGradientPaint = new GradientPaint(paramInt1 + 130, paramInt2 - 10, new Color(255, 255, 255, (int)(255.0D * this.statusAlpha)), paramInt1 + 130, paramInt2 + 6 - 10, new Color(255, 255, 255, 0), false);

      paramGraphics2D.setPaint(localGradientPaint);
      paramGraphics2D.fillRoundRect(paramInt1 + 130, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.setColor(new Color(0, 0, 0, (int)(255.0D * this.statusAlpha)));
      paramGraphics.drawString("" + getPlayerThrow().getHPPercent() + "%", paramInt1 + 145, paramInt2 - 1);

      paramGraphics.drawRoundRect(paramInt1 + 130, paramInt2 - 10, 200, 10, 11, 11);
      paramGraphics.drawRoundRect(paramInt1 + 130, paramInt2 - 10, getPlayerThrow().getHPPercent() * 2, 10, 11, 11);
    }
  }

  public void drawHealthBar(Graphics paramGraphics, Graphics2D paramGraphics2D, int paramInt1, int paramInt2)
    throws NullPointerException
  {
    if (this.round == 1) {
      if (this.hunted)
        drawHealthBarHunted(paramGraphics, paramGraphics2D, paramInt1, paramInt2);
      else
        drawHealthBarHunting(paramGraphics, paramGraphics2D, paramInt1, paramInt2);
    }
    else if (this.round == 2)
      if (this.hunted2)
        drawHealthBarHunted(paramGraphics, paramGraphics2D, paramInt1, paramInt2);
      else
        drawHealthBarHunting(paramGraphics, paramGraphics2D, paramInt1, paramInt2);
  }

  public void drawTile(Graphics paramGraphics, RSTile paramRSTile, Color paramColor1, String paramString, Color paramColor2)
  {
    RSTile localRSTile1 = new RSTile(paramRSTile.getX() + 1, paramRSTile.getY());
    RSTile localRSTile2 = new RSTile(paramRSTile.getX(), paramRSTile.getY() + 1);
    RSTile localRSTile3 = new RSTile(paramRSTile.getX() + 1, paramRSTile.getY() + 1);
    Point localPoint1 = this.calc.tileToScreen(paramRSTile, 0.0D, 0.0D, 0);
    Point localPoint2 = this.calc.tileToScreen(localRSTile1, 0.0D, 0.0D, 0);
    Point localPoint3 = this.calc.tileToScreen(localRSTile2, 0.0D, 0.0D, 0);
    Point localPoint4 = this.calc.tileToScreen(localRSTile3, 0.0D, 0.0D, 0);
    if ((localPoint1.x != -1) && (localPoint1.y != -1) && (localPoint2.x != -1) && (localPoint2.y != -1) && (localPoint3.x != -1) && (localPoint3.y != -1) && (localPoint4.x != -1) && (localPoint4.y != -1))
    {
      paramGraphics.setColor(new Color(0, 0, 0, 255));
      paramGraphics.drawPolygon(new int[] { localPoint3.x, localPoint4.x, localPoint2.x, localPoint1.x }, new int[] { localPoint3.y, localPoint4.y, localPoint2.y, localPoint1.y }, 4);

      paramGraphics.setColor(paramColor1);
      paramGraphics.fillPolygon(new int[] { localPoint3.x, localPoint4.x, localPoint2.x, localPoint1.x }, new int[] { localPoint3.y, localPoint4.y, localPoint2.y, localPoint1.y }, 4);

      paramGraphics.setColor(paramColor2);
      paramGraphics.setFont(new Font("Arial", 1, 11));
      paramGraphics.drawString(paramString, Math.max(Math.max(localPoint1.x, localPoint2.x), Math.max(localPoint3.x, localPoint4.x)) + 5, Math.min(Math.min(localPoint1.y, localPoint2.y), Math.min(localPoint3.y, localPoint4.y)) + 15);
    }
  }

  public boolean doModelAction(RSObject paramRSObject, String paramString)
  {
    try
    {
      RSModel localRSModel = paramRSObject.getModel();
      if (localRSModel != null) {
        if (paramRSObject.isOnScreen()) {
          Point localPoint = localRSModel.getPoint();
          if ((localPoint.getX() != -1.0D) && (localPoint.getY() != -1.0D)) {
            int i = 0;
            int j = 0;
            while ((j == 0) && (i < 10)) {
              this.mouse.move(localRSModel.getPoint(), 0, 0);
              if (this.menu.doAction(paramString)) {
                j = 1;
              }
              i++;
            }
            if (i < 10) {
              return true;
            }
            dlog("Object doAction failed");
            return false;
          }

          dlog("Object point not on screen");
          return false;
        }

        dlog("Object not on screen");
        return false;
      }

      dlog("Object does not have model");
      return false;
    }
    catch (NullPointerException localNullPointerException) {
    }
    return false;
  }

  public void getStone() {
    this.status = "Getting Stone...";
    try {
      int i = 0;
      this.stoneObject = this.objects.getNearest(new int[] { 30143 });
      this.stoneObject.getLocation();
      RSTile localRSTile = new RSTile(this.stoneObject.getLocation().getX() + 1, this.stoneObject.getLocation().getY());

      if (this.stoneObject.isOnScreen())
      {
        while ((this.inventory.getCount(this.stoneID) < 1) && (i == 0) && (inGame()) && (!this.dieScript) && (!this.switchingRole)) {
          if (!doModelAction(this.stoneObject, "Take-stone")) {
            try {
              this.stoneObject.doHover();
            } catch (NullPointerException localNullPointerException2) {
              if (this.dmode)
                log("stoneObject doHover fail, NullPointerException");
            }
            catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1) {
              if (this.dmode) {
                log("stoneObject doHover fail, ArrayIndexOutOfBoundsException");
              }
            }
            if (!doModelAction(this.stoneObject, "Take-stone")) {
              i = 1; continue;
            }
            sleep(1000);
            while (getMyPlayer().isMoving())
              sleep(1);
            continue;
          }
          sleep(1000);
          while (getMyPlayer().isMoving()) {
            sleep(1);
          }
        }
      }

      i = 1;

      if ((i != 0) && (!this.switchingRole)) {
        while ((this.calc.distanceTo(localRSTile) > 2) && (inGame())) {
          this.walking.walkTileOnScreen(localRSTile);
          sleep(random(500, 1000));
        }
      }

      while ((this.inventory.getCount(this.stoneID) < 1) && (inGame()) && (!this.dieScript) && (!this.switchingRole)) {
        if (!doModelAction(this.stoneObject, "Take-stone")) {
          try {
            this.stoneObject.doHover();
          } catch (NullPointerException localNullPointerException3) {
            if (this.dmode)
              log("stoneObject doHover fail, NullPointerException");
          }
          catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2) {
            if (this.dmode) {
              log("stoneObject doHover fail, ArrayIndexOutOfBoundsException");
            }
          }
          if (!doModelAction(this.stoneObject, "Take-stone")) {
            i = 1; continue;
          }
          sleep(1000);
          while (getMyPlayer().isMoving())
            sleep(1);
          continue;
        }
        sleep(1000);
        while (getMyPlayer().isMoving()) {
          sleep(1);
        }
      }

      if (this.switchingRole)
        switchRole();
    }
    catch (NullPointerException localNullPointerException1) {
      if (this.dmode)
        log("Could not get stone");
    }
  }

  public void getStoneSwitch()
  {
    this.status = "Getting Stone...";
    try {
      int i = 0;
      this.stoneObject = this.objects.getNearest(new int[] { 30143 });
      this.stoneObject.getLocation();
      RSTile localRSTile = new RSTile(this.stoneObject.getLocation().getX() + 1, this.stoneObject.getLocation().getY());

      if (this.stoneObject.isOnScreen())
      {
        while ((this.inventory.getCount(this.stoneID) < 1) && (i == 0) && (inGame()) && (!this.dieScript)) {
          if (!this.stoneObject.doClick()) {
            try {
              this.stoneObject.doHover();
            } catch (NullPointerException localNullPointerException2) {
              if (this.dmode)
                log("stoneObject doHover fail, NullPointerException");
            }
            catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException1) {
              if (this.dmode) {
                log("stoneObject doHover fail, ArrayIndexOutOfBoundsException");
              }
            }
            if (!this.stoneObject.doClick()) {
              i = 1; continue;
            }
            sleep(1500); continue;
          }

          sleep(1500);
        }
      }

      i = 1;

      if (i != 0)
      {
        while ((this.calc.distanceTo(this.stoneObject.getLocation()) > 3) && (inGame())) {
          this.walking.walkTileOnScreen(localRSTile);
          sleep(random(500, 1000));
        }
      }
      while ((this.inventory.getCount(this.stoneID) < 1) && (inGame())) {
        try {
          this.stoneObject.doHover();
          this.stoneObject.doClick();
        } catch (NullPointerException localNullPointerException3) {
          if (this.dmode)
            log("stoneObject doHover/doClick fail, NullPointerException");
        }
        catch (ArrayIndexOutOfBoundsException localArrayIndexOutOfBoundsException2) {
          if (this.dmode) {
            log("stoneObject doHover/doClick fail, ArrayIndexOutOfBoundsException");
          }
        }
        sleep(2000);
      }
    } catch (NullPointerException localNullPointerException1) {
      if (this.dmode)
        log("Could not get stone");
    }
  }

  public void wieldStone()
  {
    try {
      this.status = "Wielding Stone...";
      int i = 0;

      while ((!this.inventory.getItem(this.stoneID).doAction("Wield")) && (i < 10) && (inGame()) && (!this.dieScript)) {
        i++;
        this.mouse.moveSlightly();
      }
    } catch (NullPointerException localNullPointerException) {
    }
  }

  public void setSpell() {
    this.status = "Setting Spell...";
    this.game.openTab(7);
    sleep(50);
    try {
      if ((!this.setCombatSpells) && (this.magic.getInterface().getIndex() == 192))
      {
        int i = 0;
        while ((!this.setCombatSpells) && (i < 15)) {
          this.setCombatSpells = this.magic.getInterface().getComponent(16).doAction("");

          i++;
        }
      } else {
        this.setCombatSpells = true;
      }
    } catch (NullPointerException localNullPointerException) {
      this.setCombatSpells = true;
    }

    if (this.magicSpell.equals("Auto Highest (F2P)"))
      autoCastHighestF2P();
    else if (this.magicSpell.equals("Auto Highest (P2P)"))
      autoCastHighestP2P();
    else if (this.magicSpell.equals("Fire Surge"))
      autoCast(91);
    else if (this.magicSpell.equals("Earth Surge"))
      autoCast(90);
    else if (this.magicSpell.equals("Water Surge"))
      autoCast(87);
    else if (this.magicSpell.equals("Wind Surge"))
      autoCast(84);
    else if (this.magicSpell.equals("Fire Wave"))
      autoCast(80);
    else if (this.magicSpell.equals("Earth Wave"))
      autoCast(77);
    else if (this.magicSpell.equals("Water Wave"))
      autoCast(73);
    else if (this.magicSpell.equals("Wind Wave"))
      autoCast(70);
    else if (this.magicSpell.equals("Fire Blast"))
      autoCast(63);
    else if (this.magicSpell.equals("Earth Blast"))
      autoCast(58);
    else if (this.magicSpell.equals("Water Blast"))
      autoCast(52);
    else if (this.magicSpell.equals("Wind Blast"))
      autoCast(49);
    else if (this.magicSpell.equals("Fire Bolt"))
      autoCast(45);
    else if (this.magicSpell.equals("Earth Bolt"))
      autoCast(42);
    else if (this.magicSpell.equals("Water Bolt"))
      autoCast(39);
    else if (this.magicSpell.equals("Wind Bolt"))
      autoCast(34);
    else if (this.magicSpell.equals("Fire Strike"))
      autoCast(32);
    else if (this.magicSpell.equals("Earth Strike"))
      autoCast(30);
    else if (this.magicSpell.equals("Water Strike"))
      autoCast(28);
    else if (this.magicSpell.equals("Wind Strike"))
      autoCast(25);
    else if (this.magicSpell.equals("Wind Rush"))
      autoCast(98);
    else if (this.magicSpell.equals("Ice Barrage"))
      autoCast(23);
    else if (this.magicSpell.equals("Blood Barrage"))
      autoCast(27);
    else if (this.magicSpell.equals("Shadow Barrage"))
      autoCast(35);
    else if (this.magicSpell.equals("Smoke Barrage"))
      autoCast(31);
    else if (this.magicSpell.equals("Ice Blitz"))
      autoCast(21);
    else if (this.magicSpell.equals("Blood Blitz"))
      autoCast(25);
    else if (this.magicSpell.equals("Shadow Blitz"))
      autoCast(33);
    else if (this.magicSpell.equals("Smoke Blitz"))
      autoCast(29);
    else if (this.magicSpell.equals("Ice Burst"))
      autoCast(22);
    else if (this.magicSpell.equals("Blood Burst"))
      autoCast(26);
    else if (this.magicSpell.equals("Shadow Burst"))
      autoCast(34);
    else if (this.magicSpell.equals("Smoke Burst"))
      autoCast(30);
    else if (this.magicSpell.equals("Ice Rush"))
      autoCast(20);
    else if (this.magicSpell.equals("Blood Rush"))
      autoCast(24);
    else if (this.magicSpell.equals("Shadow Rush"))
      autoCast(32);
    else if (this.magicSpell.equals("Smoke Rush"))
      autoCast(28);
    else if (this.magicSpell.equals("Miasmic Barrage"))
      autoCast(39);
    else if (this.magicSpell.equals("Miasmic Blitz"))
      autoCast(37);
    else if (this.magicSpell.equals("Miasmic Burst"))
      autoCast(38);
    else if (this.magicSpell.equals("Miasmic Rush"))
      autoCast(36);
  }

  public boolean autoCastHighestF2P()
  {
    int i = this.skills.getCurrentLevel(6);
    if (i >= 59)
      return autoCast(63);
    if (i >= 53)
      return autoCast(58);
    if (i >= 47)
      return autoCast(52);
    if (i >= 41)
      return autoCast(49);
    if (i >= 35)
      return autoCast(45);
    if (i >= 29)
      return autoCast(42);
    if (i >= 23)
      return autoCast(39);
    if (i >= 17)
      return autoCast(34);
    if (i >= 13)
      return autoCast(32);
    if (i >= 9)
      return autoCast(30);
    if (i >= 5) {
      return autoCast(28);
    }
    return autoCast(25);
  }

  public boolean autoCastHighestP2P()
  {
    int i = this.skills.getCurrentLevel(6);
    int j = this.magic.getInterface().getIndex();

    if (j == 192) {
      if (i >= 95)
        return autoCast(91);
      if (i >= 90)
        return autoCast(90);
      if (i >= 85)
        return autoCast(87);
      if (i >= 81)
        return autoCast(84);
      if (i >= 75)
        return autoCast(80);
      if (i >= 70)
        return autoCast(77);
      if (i >= 65)
        return autoCast(73);
      if (i >= 62)
        return autoCast(70);
      if (i >= 59)
        return autoCast(63);
      if (i >= 53)
        return autoCast(58);
      if (i >= 47)
        return autoCast(52);
      if (i >= 41)
        return autoCast(49);
      if (i >= 35)
        return autoCast(45);
      if (i >= 29)
        return autoCast(42);
      if (i >= 23)
        return autoCast(39);
      if (i >= 17)
        return autoCast(34);
      if (i >= 13)
        return autoCast(32);
      if (i >= 9)
        return autoCast(30);
      if (i >= 5) {
        return autoCast(28);
      }
      return autoCast(25);
    }
    if (j == 193) {
      if (i >= 94)
        return autoCast(23);
      if (i >= 92)
        return autoCast(27);
      if (i >= 88)
        return autoCast(35);
      if (i >= 86)
        return autoCast(31);
      if (i >= 82)
        return autoCast(21);
      if (i >= 80)
        return autoCast(25);
      if (i >= 76)
        return autoCast(33);
      if (i >= 74)
        return autoCast(29);
      if (i >= 70)
        return autoCast(22);
      if (i >= 68)
        return autoCast(26);
      if (i >= 64)
        return autoCast(34);
      if (i >= 62)
        return autoCast(30);
      if (i >= 58)
        return autoCast(20);
      if (i >= 56)
        return autoCast(24);
      if (i >= 52)
        return autoCast(32);
      if (i >= 50) {
        return autoCast(28);
      }
      return false;
    }

    dlog("Spellbook error - GET OFF LUNAR!");

    return false;
  }

  public boolean autoCast(int paramInt) {
    try {
      int i = 0;
      int j = this.round;
      if (paramInt != 90)
      {
        while ((!this.magic.autoCastSpell(paramInt)) && (i < 10) && (inGame()) && (this.round == j)) {
          sleep(200);
          i++;
        }
      }

      while ((!this.magic.autoCastSpell(89)) && (i < 10) && (inGame()) && (this.round == j)) {
        sleep(200);
        i++;
      }

      return i != 10;
    }
    catch (NullPointerException localNullPointerException)
    {
    }

    return false;
  }

  public boolean attacking()
  {
    int i = 0;
    try {
      if (((getMyPlayer().getInteracting() instanceof RSPlayer)) && (inGame()))
        if (!getPlayer().isMoving()) {
          if (getPlayer().isInCombat())
            i = 1;
        }
        else
          i = 1;
    }
    catch (NullPointerException localNullPointerException)
    {
      i = 0;
    }
    return i;
  }

  public void attack() {
    this.status = "Attacking...";
    try {
      this.mouse.setSpeed(3);
      this.mouse.move(getPlayerScreenLocThrow());
      this.mouse.move(getPlayerScreenLocThrow());
      if (this.calc.tileOnScreen(getPlayerLocThrow())) {
        this.mouse.click(false);
        sleep(350, 500);
        this.mouse.setSpeed(10);
        if (this.menu.isOpen()) {
          if (this.menu.contains("Attack " + playerName())) {
            if (this.menu.doAction("Attack " + playerName())) {
              sleep(random(1700, 2200));
              this.mouse.moveSlightly();
            } else {
              while (this.menu.isOpen())
                this.mouse.moveSlightly();
            }
          }
          else {
            while (this.menu.isOpen()) {
              this.mouse.moveSlightly();
            }
          }
        }
      }
      this.mouse.setSpeed(this.mouseSpeed);
      if (this.switchingRole)
        switchRole();
    }
    catch (NullPointerException localNullPointerException) {
      dlog("Attack Player failed");
    }
    this.mouse.setSpeed(this.mouseSpeed);
  }

  public boolean atCenter()
  {
    return this.calc.distanceTo(this.centerTile) <= 1;
  }

  public boolean opponentAtCenter()
    throws NullPointerException
  {
    return this.calc.distanceBetween(getPlayerLocThrow(), this.centerTile) <= 4.0D;
  }

  public void search()
  {
    this.status = "Searching for Opponent...";
    this.antiBanTime = false;
    RSTile localRSTile = new RSTile(this.searchTilesX[this.searchTileOn], this.searchTilesY[this.searchTileOn]);

    RSTile[] arrayOfRSTile = this.walking.findPath(localRSTile);
    this.walking.walkPathMM(arrayOfRSTile);
    sleep(random(200, 700));
    if ((getMyPlayer().isMoving()) || (this.searchTileOn == 0)) {
      this.s.reset();
    }
    if (!this.s.isRunning()) {
      dlog("been standing still too long, cancelling search");
      this.timerStarted = false;
      this.searchTileOn = 0;
      this.searching = false;
      this.antiBanTime = true;
    }
    if (this.calc.distanceBetween(getMyPlayer().getLocation(), localRSTile) < 11.0D) {
      this.searchTileOn += 1;
    }
    if (this.searchTileOn == 8) {
      this.timerStarted = false;
      this.searchTileOn = 0;
      this.searching = false;
      this.antiBanTime = true;
    }
  }

  public void useTeleOrb() {
    this.status = "Using TeleOrb...";
    if (this.inventory.getCount(false, new int[] { this.teleorbID }) > 0) {
      RSItem localRSItem = this.inventory.getItem(new int[] { this.teleorbID });
      int i = 0;
      while ((i == 0) && (inGame())) {
        if (localRSItem.doClick(true)) {
          i = 1;
          sleep(random(3000, 3500)); continue;
        }
        sleep(random(50, 200));
      }

    }
    else if (this.dmode) {
      log("No TeleOrb to use");
    }
  }

  public void setSearchTiles()
  {
    int i = getMyPlayer().getLocation().getX();
    int j = getMyPlayer().getLocation().getY();
    if ((i >= 1652) && (i <= 1675) && (j >= 5654) && (j <= 5668))
      this.spawnArea = 0;
    else if ((i >= 1627) && (i <= 1646) && (j >= 5662) && (j <= 5682))
      this.spawnArea = 1;
    else if ((i >= 1620) && (i <= 1637) && (j >= 5685) && (j <= 5710))
      this.spawnArea = 2;
    else if ((i >= 1629) && (i <= 1649) && (j >= 5713) && (j <= 5731))
      this.spawnArea = 3;
    else if ((i >= 1651) && (i <= 1675) && (j >= 5720) && (j <= 5735))
      this.spawnArea = 4;
    else if ((i >= 1677) && (i <= 1695) && (j >= 5706) && (j <= 5723))
      this.spawnArea = 5;
    else if ((i >= 1687) && (i <= 1708) && (j >= 5686) && (j <= 5704))
      this.spawnArea = 6;
    else if ((i >= 1678) && (i <= 1706) && (j >= 5665) && (j <= 5684)) {
      this.spawnArea = 7;
    }
    if (this.dmode) {
      log("Spawn Area: " + Integer.toString(this.spawnArea));
    }

    int k = 0;
    int m = this.spawnArea;
    while (k < 8) {
      if (m > 7) {
        m = 0;
      }
      this.searchTilesX[k] = this.searchTilesXOrig[m];
      k++;
      m++;
    }

    int n = 0;
    int i1 = this.spawnArea;
    while (n < 8) {
      if (i1 > 7) {
        i1 = 0;
      }
      this.searchTilesY[n] = this.searchTilesYOrig[i1];
      n++;
      i1++;
    }
    if (this.dmode)
      log("Search Tiles Set...");
  }

  public void startup() throws NullPointerException
  {
    if (this.dmode) {
      log("Starting up...");
      String str = Integer.toString(getMyPlayer().getLocation().getX()) + ", " + Integer.toString(getMyPlayer().getLocation().getY());

      log("Spawn pos: " + str);
    }
    if (this.round == 1) {
      if (this.hunted) {
        getStone();
        if (this.hunted) {
          wieldStone();
          if (this.teleorb.equals("hunted"))
            useTeleOrb();
          else if ((this.teleorb.equals("random")) && 
            (this.tRandom > 500))
            useTeleOrb();
        }
      }
      else
      {
        setSearchTiles();
        if (this.FSGame)
          this.currentStyle = this.firstStyle;
        setupStyleEquipment();
        setupStyle();
        if (this.currentStyle.equals("Magic"))
          setSpell();
        if (this.teleorb.equals("hunting"))
          useTeleOrb();
        else if ((this.teleorb.equals("random")) && 
          (this.tRandom <= 500)) {
          useTeleOrb();
        }
      }

      this.startedUp = true;
    } else if (this.round == 2) {
      if (this.hunted2) {
        getStone();
        if (this.hunted2) {
          wieldStone();
          if (this.teleorb.equals("hunted"))
            useTeleOrb();
          else if ((this.teleorb.equals("random")) && 
            (this.tRandom > 500))
            useTeleOrb();
        }
      }
      else
      {
        setSearchTiles();
        if (this.FSGame) {
          this.currentStyle = this.firstStyle;
        }
        setupStyleEquipment();
        setupStyle();
        if (this.currentStyle.equals("Magic")) {
          setSpell();
        }
        if (this.teleorb.equals("hunting"))
          useTeleOrb();
        else if ((this.teleorb.equals("random")) && 
          (this.tRandom <= 500)) {
          useTeleOrb();
        }
      }

      this.startedUp2 = true;
    }
  }

  public boolean playerGoneThroughPortal() {
    int i = 0;
    int j = this.lastKnownLoc.getX();
    int k = this.lastKnownLoc.getY();
    RSArea localRSArea1 = new RSArea(1649, 5701, 1653, 5705);
    RSArea localRSArea2 = new RSArea(1665, 5702, 1669, 5706);
    RSArea localRSArea3 = new RSArea(1674, 5686, 1678, 5690);
    RSArea localRSArea4 = new RSArea(1654, 5681, 1658, 5685);

    if ((localRSArea1.contains(j, k)) || (localRSArea2.contains(j, k)) || (localRSArea3.contains(j, k)) || (localRSArea4.contains(j, k)))
    {
      i = 1;
    }
    return i;
  }

  public int getItemIDT(String paramString) {
    RSItem[] arrayOfRSItem = this.inventory.getItems();
    int i = -1;
    for (int j = 0; j < arrayOfRSItem.length; j++) {
      if (arrayOfRSItem[j].getName().contains(paramString)) {
        i = arrayOfRSItem[j].getID();
      }
    }
    return i;
  }

  public void bankUBIs()
  {
    this.status = "Banking Disallowed Items";
    if (this.dmode) {
      log("Disallowed item in inventory, banking...");
    }
    int i = this.UBIString.indexOf("arena:") + 7;
    String str = this.UBIString.substring(i);
    if (this.dmode) {
      log("item name string: \"" + str + "\"");
    }
    int j = getItemIDT(str);
    if (this.dmode) {
      log("ID is " + j);
    }
    RSTile localRSTile1 = new RSTile(1704, 5599);
    RSTile[] arrayOfRSTile = this.walking.findPath(localRSTile1);
    while (this.calc.distanceTo(localRSTile1) > 3) {
      if (this.dmode) {
        log("Walking to tile close to banker");
      }
      this.walking.walkPathMM(arrayOfRSTile);
      sleep(random(1000, 2000));
    }
    RSNPC localRSNPC = this.npcs.getNearest(new int[] { 7605 });
    while ((!localRSNPC.isOnScreen()) || (localRSNPC.isMoving())) {
      if (this.dmode) {
        log("Walking to banker location");
      }
      RSTile localRSTile2 = localRSNPC.getLocation();
      this.walking.walkPathMM(this.walking.findPath(localRSTile2));
      sleep(random(500, 1500));
    }
    while (!this.bank.isOpen()) {
      if (this.dmode) {
        log("clicking on banker...");
      }
      localRSNPC.doAction("Bank Banker");
      sleep(1500);
    }
    while (this.inventory.getCount(new int[] { j }) != 0) {
      try {
        this.bank.deposit(j, 0);
        sleep(500);
        if (this.inventory.getCount(new int[] { j }) > 0)
          sleep(random(800, 1100));
      }
      catch (NullPointerException localNullPointerException) {
        if (this.dmode) {
          log("bad item null exception...");
        }
      }
    }
    if ((this.bank.isOpen()) && 
      (random(1, 2) == 2)) {
      this.bank.close();
    }

    this.bankingUBIs = false;
  }

  public void bankTokensM()
  {
    this.status = "Banking Tokens";
    int i = this.inventory.getCount(true, new int[] { this.tokenID });
    while (this.inventory.getCount(true, new int[] { this.tokenID }) > 0) {
      RSNPC localRSNPC = this.npcs.getNearest(new int[] { 7605 });
      while ((!localRSNPC.isOnScreen()) || (localRSNPC.isMoving())) {
        RSTile localRSTile = localRSNPC.getLocation();
        this.walking.walkPathMM(this.walking.findPath(localRSTile));
        sleep(random(500, 1500));
      }
      while (!this.bank.isOpen()) {
        localRSNPC.doAction("Bank Banker");
        sleep(1500);
      }
      while (this.inventory.getCount(true, new int[] { this.tokenID }) > 0)
        try {
          this.bank.deposit(this.tokenID, 0);
          sleep(500);
          if (this.inventory.getCount(true, new int[] { this.tokenID }) > 0)
            sleep(random(800, 1100));
        }
        catch (NullPointerException localNullPointerException)
        {
        }
      this.bankedTokens += i;
      if ((this.bank.isOpen()) && 
        (random(100, 200) > 100))
        this.bank.close();
    }
  }

  public int loop()
  {
    try
    {
      if (!this.initialised) {
        initialiseImages();
        if (this.loginWait) {
          this.status = "Waiting for Login...";
          sleep(4000, 5000);
        }
        this.loginWait = false;
        initialise();
      }
      if (this.dieScript) {
        log("Stopping Script...");
        stopScript();
      } else {
        if (this.camera.getPitch() < 100) {
          while (this.camera.getPitch() < 100) {
            char c1 = '&';
            this.keyboard.pressKey(c1);
            sleep(2000);
            this.keyboard.releaseKey(c1);
          }
        }
        if (this.game.getCurrentTab() != 4) {
          this.game.openTab(4);
          this.mouse.moveSlightly();
        }
        if (this.switchingRole) {
          switchRole();
        }
        if (this.walking.getEnergy() > random(35, 50)) {
          this.walking.setRun(true);
          sleep(1000);
        }
        if (this.walking.getEnergy() < 1) {
          this.walking.setRun(false);
          sleep(1000);
        }
        if ((this.useAntiBan) && 
          (this.antiBanTime)) {
          antiBan();
        }
        try
        {
          this.currentTokens = this.inventory.getCount(true, new int[] { this.tokenID });
        }
        catch (NullPointerException localNullPointerException1)
        {
        }
        Object localObject;
        int i1;
        if (inLobby()) {
          this.overallStatus = "In Lobby";
          this.canDrawInfo = false;
          this.canDrawTheirTile = false;
          this.antiBanTime = true;
          this.walkedOnce = false;
          int n;
          double d;
          int i3;
          if (this.justStarted) {
            if ((this.randomGameSwitch) && 
              (!this.nextRandomSwitchSet)) {
              int i = random(1000, 5000);
              n = 1000;
              d = i / n;

              i3 = (int)Math.round(d);
              if (this.dmode) {
                log("Next style switch: " + i3);
              }
              this.nextRandomSwitch = i3;
              this.nextRandomSwitchSet = true;
            }

            sleep(250);
            try {
              this.startRating = Integer.parseInt(this.interfaces.get(731).getComponent(7).getText().substring(this.interfaces.get(731).getComponent(7).getText().indexOf(":") + 2));

              this.currentRating = Integer.parseInt(this.interfaces.get(731).getComponent(7).getText().substring(this.interfaces.get(731).getComponent(7).getText().indexOf(":") + 2));
            }
            catch (StringIndexOutOfBoundsException localStringIndexOutOfBoundsException1)
            {
              if (this.dmode)
                localStringIndexOutOfBoundsException1.printStackTrace();
            }
            catch (NumberFormatException localNumberFormatException1) {
              if (this.dmode) {
                localNumberFormatException1.printStackTrace();
              }
            }
            this.gainedRating = 0;
            this.justStarted = false;
          }
          if (this.justPlayed) {
            if (this.dmode) {
              log("In Lobby");
            }
            if (this.everyGameSwitch) {
              setRandomStyle();
            } else if (this.randomGameSwitch) {
              if (this.nextRandomSwitch == this.gamesPlayed) {
                setRandomStyle();
                this.mouse.moveSlightly();
                this.nextRandomSwitchSet = false;
              }
              if (!this.nextRandomSwitchSet) {
                int j = random(1000, 5000);
                n = 1000;
                d = j / n;

                i3 = (int)Math.round(d);
                if (this.dmode) {
                  log("Next style switch: " + i3);
                }
                this.nextRandomSwitch = (this.gamesPlayed + i3);
                this.nextRandomSwitchSet = true;
              }
            }
            sleep(1500, 2500);
            this.justPlayed = false;
            this.gotRatingInfo = false;
          }
          if (!this.gotRatingInfo) {
            try {
              this.currentRating = Integer.parseInt(this.interfaces.get(731).getComponent(7).getText().substring(this.interfaces.get(731).getComponent(7).getText().indexOf(":") + 2));

              this.gainedRating = (this.currentRating - this.startRating);
              this.gotRatingInfo = true;
              dlog("Got Rating Stats");
            } catch (StringIndexOutOfBoundsException localStringIndexOutOfBoundsException2) {
              if (this.dmode)
                localStringIndexOutOfBoundsException2.printStackTrace();
            }
            catch (NumberFormatException localNumberFormatException2) {
              if (this.dmode) {
                localNumberFormatException2.printStackTrace();
              }
            }
          }
          if (this.bankTokens) {
            if (this.inventory.getCount(true, new int[] { this.tokenID }) > this.tokensBeforeBank) {
              bankTokensM();
              this.mouse.moveSlightly();
            }
          }
          while (this.inventory.getCount(this.NAIDs) > 0) {
            this.status = "Banking Disallowed Items";
            localObject = this.npcs.getNearest(new int[] { 7605 });
            while ((!((RSNPC)localObject).isOnScreen()) || (((RSNPC)localObject).isMoving())) {
              RSTile localRSTile = ((RSNPC)localObject).getLocation();
              this.walking.walkPathMM(this.walking.findPath(localRSTile));
              sleep(random(500, 1500));
            }
            while (!this.bank.isOpen()) {
              ((RSNPC)localObject).doAction("Bank Banker");
              this.mouse.moveSlightly();
              sleep(1500);
            }
            for (i1 = 0; i1 < this.NAIDs.length; i1++) {
              while (this.inventory.getCount(new int[] { this.NAIDs[i1] }) > 0)
                try {
                  this.bank.deposit(this.NAIDs[i1], 0);
                  this.mouse.moveSlightly();
                  sleep(500);
                  if (this.inventory.getCount(new int[] { this.NAIDs[i1] }) > 0)
                    sleep(random(800, 1100));
                }
                catch (NullPointerException localNullPointerException5)
                {
                }
            }
            if ((this.bank.isOpen()) && 
              (random(1000, 2000) > 1000)) {
              this.bank.close();
            }
          }

          if (!this.calc.tileOnScreen(this.entrance)) {
            this.status = "Walking to Waiting Room...";
            if (!this.dieScript) {
              this.walking.walkPathMM(this.walking.findPath(this.entranceBefore));
              this.mouse.moveSlightly();
              sleep(random(600, 1000));
            }
          } else {
            if (this.bank.isOpen()) {
              this.bank.close();
            }
            if (!getMyPlayer().isMoving()) {
              this.status = "Going into Waiting Room...";
              this.mouse.setSpeed(3);
              localObject = this.objects.getNearest(new int[] { 30224 });
              this.mouse.move(this.calc.tileToScreen(this.entrance, 1));
              i1 = 0;

              while ((!((RSObject)localObject).doAction("Go-through")) && (i1 < 10) && (inLobby())) {
                sleep(400);
                i1++;
              }
              this.mouse.setSpeed(this.mouseSpeed);
              this.mouse.moveSlightly();
              int i2 = 0;
              while ((inLobby()) && (!this.bankingUBIs)) {
                sleep(10);
                i2 += 10;
                if (i2 > 1000) {
                  turnCamera();
                }
              }
            }

            if (this.bankingUBIs) {
              bankUBIs();
              this.mouse.moveSlightly();
            }
          }
        }

        if ((inWaitingRoom()) && 
          (!this.walkedOnce)) {
          this.prevHd = -1;
          this.prevHg = -1;
          this.canDrawInfo = false;
          this.canDrawTheirTile = false;
          this.roundOneHunted = false;
          this.startedUp = false;
          this.startedUp2 = false;
          this.gone = false;
          this.gone2 = false;
          this.hunted = false;
          this.hunted2 = false;
          this.setVarsRound1 = false;
          this.setVarsRound2 = false;
          this.round = 1;
          this.timerStarted = false;
          this.searching = false;
          this.searchTileOn = 0;
          this.walkedOnce = true;
          this.antiBanTime = true;
          this.canGoFailed = 0;
          this.overrideGoReceived = false;
          this.meleeTimerStarted = false;
          this.stoneHovered = false;
          this.lastKnownHealth = 100;
          this.lastKnownLoc = new RSTile(-1, -1);
          this.timerToUse = 1;
          this.lastPrayerSet = 0;
          this.lastAttackPrayerSet = 0;
          this.lastSkinPrayerSet = -1;
          this.tRandom = random(0, 1000);
          this.overallStatus = "In Waiting Room";
          this.status = "Waiting...";
          sleep(random(825, 1225));
          this.walking.walkTileOnScreen(new RSTile(random(1650, 1652), random(5598, 5604)));

          sleep(500);
        }

        if (inGame()) {
          this.justPlayed = true;
          RSTile[] arrayOfRSTile1;
          if (this.round == 1) {
            if (!this.setVarsRound1) {
              this.goTimer.reset();
              this.prevHg = this.interfaces.get(730).getComponent(26).getBoundsArrayIndex();

              this.prevHd = this.interfaces.get(730).getComponent(27).getBoundsArrayIndex();

              this.setVarsRound1 = true;
            }
            if (!this.gone) {
              this.overallStatus = "In Game";
              this.status = "Waiting for 'Go!'";
              this.antiBanTime = true;
              this.canDrawInfo = false;
              this.canDrawTheirTile = false;
              if ((!this.goReceived) && (!this.overrideGoReceived) && 
                (!this.goTimer.isRunning())) {
                this.overrideGoReceived = true;
              }

              if ((this.goReceived) || (this.overrideGoReceived)) {
                if (this.overrideGoReceived) {
                  if (this.dmode) {
                    log("goReceived overriden, going...");
                  }
                }
                else if (this.dmode) {
                  log("goReceived true, going...");
                }

                this.gone = true;
                this.goReceived = false;
                this.overrideGoReceived = false;
              }
            }
            if (this.gone) {
              if (!this.startedUp) {
                this.prevHg = this.interfaces.get(730).getComponent(26).getBoundsArrayIndex();

                this.prevHd = this.interfaces.get(730).getComponent(27).getBoundsArrayIndex();

                if (this.prevHg != -1) {
                  this.hunted = false;
                  this.roundOneHunted = false;
                  this.overallStatus = "Round 1, Hunting";
                  if (this.dmode)
                    log("Hunting, Round 1");
                }
                else {
                  this.hunted = true;
                  this.roundOneHunted = true;
                  this.overallStatus = "Round 1, Being Hunted";
                  if (this.dmode) {
                    log("Being Hunted, Round 1");
                  }
                }
                this.canGoFailed = 0;
                this.overrideGoReceived = false;
                if (this.dmode) {
                  log("Round 1 Starting Up...");
                }
                this.antiBanTime = false;
                if ((this.hitSwitch) && (!this.hunted)) {
                  setNextHitSwitch();
                }
                startup();
              }
              if (this.hunted) {
                if (!atCenter()) {
                  this.status = "Running to Center";
                  this.antiBanTime = false;
                  localObject = this.walking.findPath(this.centerTile);

                  this.walking.walkPathMM(localObject);
                  sleep(random(600, 1200));
                } else {
                  this.status = "At Center";
                  this.antiBanTime = true;
                }
                if (playerLocKnown()) {
                  this.canDrawInfo = true;
                  this.canDrawTheirTile = true;
                  if (getMyPlayer().isInCombat()) {
                    setPrayer();
                    if (playerLocKnown())
                      setDefenceStyle();
                    setSkinPrayer();
                    if ((this.useQuickPrayers) && 
                      (this.quickPrayersLong.equals("When Being Hunted")))
                    {
                      setQuickPrayers(true);
                    }
                  }
                  else {
                    turnOffPrayer();
                  }
                } else {
                  this.canDrawInfo = false;
                  this.canDrawTheirTile = false;
                }
                if ((getMyPlayer().getHPPercent() < 50) && 
                  (this.useBandages)) {
                  if (this.inventory.getCount(false, new int[] { this.bandagesID }) > 0)
                  {
                    this.status = "Using Bandages...";
                    dlog("Using Bandages...");
                    doActionExtreme(this.bandagesID, "Heal");
                  }
                }

                if (getMyPlayer().getHPPercent() < 1) {
                  this.status = "Dying...";
                  this.antiBanTime = false;
                  if (this.dmode) {
                    log("Died");
                  }
                  this.stoneHovered = false;
                  this.lastPrayerSet = 0;
                  this.lastAttackPrayerSet = 0;
                  this.lastSkinPrayerSet = -1;
                  this.lastKnownHealth = 100;
                  this.round = 2;
                  this.lastKnownLoc = new RSTile(-1, -1);
                  this.timerToUse = 1;
                  this.canDrawTheirTile = false;
                  this.meleeTimerStarted = false;
                  while (playerLocKnown()) {
                    this.timerStarted = false;
                    sleep(1);
                  }
                }
              } else {
                if (playerLocKnown()) {
                  this.canDrawInfo = true;
                  this.canDrawTheirTile = true;
                  this.timerStarted = false;
                  this.searchTileOn = 0;
                  this.searching = false;
                  if ((this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLoc()) > 4.3D) && (!attacking()))
                  {
                    this.status = "Running to Opponent...";
                    this.antiBanTime = false;
                    this.walking.walkPathMM(this.walking.findPath(getPlayerLoc()));

                    if ((this.currentStyle.equals("Magic")) || (this.currentStyle.equals("Range")))
                      try
                      {
                        if (this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLocThrow()) < 15.0D)
                        {
                          char c2 = '(';
                          this.keyboard.pressKey(c2);
                          this.camera.turnToCharacter(getPlayerThrow());
                          i1 = 0;

                          while ((this.camera.getPitch() > 5) && (i1 < 1000)) {
                            i1++;
                            sleep(1);
                          }
                          this.keyboard.releaseKey(c2);
                          if (this.calc.tileOnScreen(getPlayerLocThrow()))
                            attack();
                        }
                      }
                      catch (NullPointerException localNullPointerException2)
                      {
                      }
                    int k = 0;

                    while ((playerLocKnown()) && (this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLoc()) > 4.3D) && (k < random(300, 400))) {
                      sleep(1);
                      k++;
                    }
                  }
                  if ((playerLocKnown()) && ((this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLoc()) <= 4.3D) || (attacking())))
                  {
                    if (getPlayer().getHPPercent() > 0) {
                      if (!attacking()) {
                        this.antiBanTime = false;
                        attack();
                      } else {
                        if (this.currentStyle.equals("Melee"))
                        {
                          if ((this.calc.distanceTo(getPlayerLoc()) > 1) && (!getMyPlayer().isMoving()) && (!getPlayer().isMoving()))
                          {
                            if (this.meleeSafeSpotSwitch) {
                              setRandomStyle();
                              if (this.currentStyle.equals("Magic"))
                              {
                                setSpell();
                              }
                            }
                            else if (!this.meleeTimerStarted) {
                              this.meleeTimer.reset();

                              this.meleeTimerStarted = true;
                            } else {
                              if (!this.meleeTimer.isRunning())
                              {
                                attack();
                              }
                              this.meleeTimerStarted = false;
                            }
                          }
                          else
                            this.meleeTimerStarted = false;
                        }
                        else {
                          this.meleeTimerStarted = false;
                        }
                        setAttackPrayer();
                        if ((this.useQuickPrayers) && 
                          (this.quickPrayersLong.equals("When Hunting")))
                        {
                          setQuickPrayers(true);
                        }

                        if (this.currentStyle.equals("Magic"))
                        {
                          if (!maging()) {
                            setSpell();
                          }
                        }
                        if ((this.hitSwitch) && 
                          (this.hits >= this.nextHitSwitch)) {
                          this.hits = 0;
                          setNextHitSwitch();
                          setRandomStyle();
                          if (this.currentStyle.equals("Magic"))
                          {
                            setSpell();
                          }
                        }

                        this.status = "Attacking Opponent";
                        this.antiBanTime = true;
                      }
                    } else {
                      this.status = "Opponent Killed";
                      if (this.dmode) {
                        log("Opponent Killed");
                      }
                      this.round = 2;
                      while (playerLocKnown()) {
                        this.lastKnownHealth = 100;
                        this.antiBanTime = false;
                        this.timerStarted = false;
                        this.searchTileOn = 0;
                        this.searching = false;
                        this.stoneHovered = false;
                        this.lastPrayerSet = 0;
                        this.lastAttackPrayerSet = 0;
                        this.lastSkinPrayerSet = -1;
                        sleep(1);
                        this.lastKnownLoc = new RSTile(-1, -1);

                        this.timerToUse = 1;
                        this.meleeTimerStarted = false;
                      }
                    }
                  }
                } else {
                  this.canDrawInfo = false;
                  this.canDrawTheirTile = false;
                  setQuickPrayers(false);
                  if (playerGoneThroughPortal())
                    this.timerToUse = 2;
                  else {
                    this.timerToUse = 1;
                  }
                  if ((!atCenter()) && (!this.searching)) {
                    this.status = "Running to Center";
                    this.antiBanTime = false;
                    arrayOfRSTile1 = this.walking.findPath(this.centerTile);

                    this.walking.walkPathMM(arrayOfRSTile1);
                    sleep(random(600, 1200));
                    this.timerStarted = false;
                  } else {
                    this.status = "Waiting at Center";
                    if (this.search) {
                      if (!this.searching) {
                        if (!this.timerStarted) {
                          if (this.timerToUse == 1)
                            this.t.reset();
                          else {
                            this.t2.reset();
                          }
                          this.timerStarted = true;
                        }
                        if (this.timerToUse == 1) {
                          if (!this.t.isRunning()) {
                            if (this.dmode) {
                              log("Searching for player...");
                            }
                            this.searching = true;
                            this.timerStarted = false;
                          }
                        }
                        else if (!this.t2.isRunning()) {
                          if (this.dmode) {
                            log("Searching for player...");
                          }
                          this.searching = true;
                          this.timerStarted = false;
                        }
                      }
                      else {
                        search();
                      }
                    }
                    this.antiBanTime = true;
                  }
                }
                setupStyleEquipment();
              }
            }
          } else if (this.round == 2) {
            if (!this.setVarsRound2) {
              this.goTimer.reset();
              this.setVarsRound2 = true;
            }
            if (!this.gone2) {
              this.overallStatus = "In Game";
              this.status = "Waiting for 'Go!'";
              this.canDrawInfo = false;
              this.canDrawTheirTile = false;
              this.antiBanTime = true;
              if ((!this.goReceived) && (!this.overrideGoReceived) && 
                (!this.goTimer.isRunning())) {
                this.overrideGoReceived = true;
              }

              if ((this.goReceived) || (this.overrideGoReceived)) {
                if (this.overrideGoReceived) {
                  if (this.dmode) {
                    log("goReceived overriden, going");
                  }
                }
                else if (this.dmode) {
                  log("goReceived is true, going");
                }

                this.gone2 = true;
                this.goReceived = false;
                this.overrideGoReceived = false;
              }
            }
            if (this.gone2) {
              if (!this.startedUp2) {
                if (this.roundOneHunted) {
                  this.hunted2 = false;
                  this.overallStatus = "Round 2, Hunting";
                  if (this.dmode)
                    log("Hunting, Round 2");
                }
                else {
                  this.hunted2 = true;
                  this.overallStatus = "Round 2, Being Hunted";
                  if (this.dmode) {
                    log("Being Hunted, Round 2");
                  }
                }
                this.canGoFailed = 0;
                this.overrideGoReceived = false;
                if (this.dmode) {
                  log("Round 2 Starting Up...");
                }
                this.antiBanTime = false;
                if ((this.hitSwitch) && (!this.hunted2)) {
                  setNextHitSwitch();
                }
                startup();
              }
              if (this.hunted2) {
                if (!atCenter()) {
                  this.status = "Running to Center...";
                  this.antiBanTime = false;
                  arrayOfRSTile1 = this.walking.findPath(this.centerTile);

                  this.walking.walkPathMM(arrayOfRSTile1);
                  sleep(random(600, 1200));
                } else {
                  this.status = "At Center";
                  this.antiBanTime = true;
                }
                if (playerLocKnown()) {
                  this.canDrawInfo = true;
                  this.canDrawTheirTile = true;
                  if (getMyPlayer().isInCombat()) {
                    setPrayer();
                    if (playerLocKnown())
                      setDefenceStyle();
                    setSkinPrayer();
                    if ((this.useQuickPrayers) && 
                      (this.quickPrayersLong.equals("When Being Hunted")))
                    {
                      setQuickPrayers(true);
                    }
                  }
                  else {
                    turnOffPrayer();
                  }
                } else {
                  this.canDrawInfo = false;
                  this.canDrawTheirTile = false;
                }
                if ((getMyPlayer().getHPPercent() < 50) && 
                  (this.useBandages)) {
                  if (this.inventory.getCount(false, new int[] { this.bandagesID }) > 0)
                  {
                    this.status = "Using Bandages...";
                    dlog("Using Bandages...");
                    doActionExtreme(this.bandagesID, "Heal");
                  }
                }

                if (getMyPlayer().getHPPercent() < 1) {
                  this.status = "Dying...";
                  if (this.dmode) {
                    log("Died");
                  }
                  this.canDrawTheirTile = false;
                  this.justPlayed = true;
                  sleep(3500);
                }
              } else {
                if (playerLocKnown()) {
                  this.canDrawInfo = true;
                  this.canDrawTheirTile = true;
                  this.timerStarted = false;
                  this.searchTileOn = 0;
                  this.searching = false;
                  if ((this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLoc()) > 4.3D) && (!attacking()))
                  {
                    this.status = "Running to Opponent";
                    this.antiBanTime = false;
                    this.walking.walkPathMM(this.walking.findPath(getPlayerLoc()));

                    if ((this.currentStyle.equals("Magic")) || (this.currentStyle.equals("Range")))
                      try
                      {
                        if (this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLocThrow()) < 15.0D)
                        {
                          char c3 = '(';
                          this.keyboard.pressKey(c3);
                          this.camera.turnToCharacter(getPlayerThrow());
                          i1 = 0;

                          while ((this.camera.getPitch() > 5) && (i1 < 1000)) {
                            i1++;
                            sleep(1);
                          }
                          this.keyboard.releaseKey(c3);
                          if (this.calc.tileOnScreen(getPlayerLocThrow()))
                            attack();
                        }
                      }
                      catch (NullPointerException localNullPointerException3)
                      {
                      }
                    int m = 0;

                    while ((playerLocKnown()) && (this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLoc()) > 4.3D) && (m < random(300, 400))) {
                      sleep(1);
                      m++;
                    }
                  }
                  if ((playerLocKnown()) && ((this.calc.distanceBetween(getMyPlayer().getLocation(), getPlayerLoc()) <= 4.3D) || (attacking())))
                  {
                    if (getPlayer().getHPPercent() > 0) {
                      if (!attacking()) {
                        this.antiBanTime = false;
                        attack();
                      } else {
                        if (this.currentStyle.equals("Melee"))
                        {
                          if ((this.calc.distanceTo(getPlayerLoc()) > 1) && (!getMyPlayer().isMoving()) && (!getPlayer().isMoving()))
                          {
                            if (this.meleeSafeSpotSwitch) {
                              setRandomStyle();
                              if (this.currentStyle.equals("Magic"))
                              {
                                setSpell();
                              }
                            }
                            else if (!this.meleeTimerStarted) {
                              this.meleeTimer.reset();

                              this.meleeTimerStarted = true;
                            } else {
                              if (!this.meleeTimer.isRunning())
                              {
                                attack();
                              }
                              this.meleeTimerStarted = false;
                            }
                          }
                          else
                            this.meleeTimerStarted = false;
                        }
                        else {
                          this.meleeTimerStarted = false;
                        }
                        setAttackPrayer();
                        if ((this.useQuickPrayers) && 
                          (this.quickPrayersLong.equals("When Hunting")))
                        {
                          setQuickPrayers(true);
                        }

                        if (this.currentStyle.equals("Magic"))
                        {
                          if (!maging()) {
                            setSpell();
                          }
                        }
                        if ((this.hitSwitch) && 
                          (this.hits >= this.nextHitSwitch)) {
                          this.hits = 0;
                          setNextHitSwitch();
                          setRandomStyle();
                          if (this.currentStyle.equals("Magic"))
                          {
                            setSpell();
                          }
                        }

                        this.status = "Attacking Opponent";
                        this.antiBanTime = true;
                      }
                    } else {
                      this.status = "Opponent Killed";
                      if (this.dmode) {
                        log("Opponent Killed");
                      }
                      this.justPlayed = true;
                      sleep(3500);
                    }
                  }
                } else {
                  this.canDrawInfo = false;
                  this.canDrawTheirTile = false;
                  setQuickPrayers(false);
                  if (playerGoneThroughPortal())
                    this.timerToUse = 2;
                  else {
                    this.timerToUse = 1;
                  }
                  if ((!atCenter()) && (!this.searching)) {
                    this.status = "Running to Center...";
                    this.antiBanTime = false;
                    RSTile[] arrayOfRSTile2 = this.walking.findPath(this.centerTile);

                    this.walking.walkPathMM(arrayOfRSTile2);
                    sleep(random(600, 1200));
                    this.timerStarted = false;
                  } else {
                    this.status = "Waiting at Center";
                    if (this.search) {
                      if (!this.searching) {
                        if (!this.timerStarted) {
                          if (this.timerToUse == 1)
                            this.t.reset();
                          else {
                            this.t2.reset();
                          }
                          this.timerStarted = true;
                        }
                        if (this.timerToUse == 1) {
                          if (!this.t.isRunning()) {
                            if (this.dmode) {
                              log("Searching for player...");
                            }
                            this.searching = true;
                            this.timerStarted = false;
                          }
                        }
                        else if (!this.t2.isRunning()) {
                          if (this.dmode) {
                            log("Searching for player...");
                          }
                          this.searching = true;
                          this.timerStarted = false;
                        }
                      }
                      else {
                        search();
                      }
                    }
                    this.antiBanTime = true;
                  }
                }
                setupStyleEquipment();
              }
            }
          }
        }
      }
    } catch (NullPointerException localNullPointerException4) {
      dlog("MAIN LOOP NULLPOINTER");
      if (this.dmode)
        localNullPointerException4.printStackTrace();
    }
    return 0;
  }

  public double round2(double paramDouble) {
    double d1 = paramDouble * 100.0D;
    int i = (int)d1;
    double d2 = i;
    double d3 = d2 / 100.0D;
    return d3;
  }

  public double getRatio() {
    double d1 = 666.0D;
    double d2 = this.gamesWon;
    double d3 = this.gamesLost;
    if ((this.gamesWon != 0) && (this.gamesLost != 0)) {
      d1 = round2(d2 / d3);
    }
    else if ((this.gamesLost == 0) && (this.gamesWon != 0))
      d1 = d2;
    else if ((this.gamesLost != 0) && (this.gamesWon == 0))
      d1 = 0.0D;
    else if ((this.gamesLost == 0) && (this.gamesWon == 0)) {
      d1 = 0.0D;
    }

    return d1;
  }

  public double getRatio2() {
    double d1 = 666.0D;
    double d2 = this.gamesWon;
    double d3 = this.gamesPlayed;
    if ((this.gamesWon != 0) && (this.gamesPlayed != 0)) {
      d1 = round2(d2 / d3);
    }
    else if ((this.gamesPlayed == 0) && (this.gamesWon != 0))
      d1 = d2;
    else if ((this.gamesPlayed != 0) && (this.gamesWon == 0))
      d1 = 0.0D;
    else if ((this.gamesPlayed == 0) && (this.gamesWon == 0)) {
      d1 = 0.0D;
    }

    return d1;
  }

  public void onFinish()
  {
    this.status = "Stopping Script...";
    log("Gained " + this.tokensGained + " Tokens in " + this.hours + ":" + this.minutes + ":" + this.seconds + " - " + this.tokensPerHour + " Tokens Per Hour");

    log("Games Played: " + this.gamesPlayed + ", Won: " + this.gamesWon + ", Lost: " + this.gamesLost + ", W/L Ratio: " + getRatio());

    log("Thank You for using FOGRunner by TerraBubble");
  }

  public void messageReceived(MessageEvent paramMessageEvent)
  {
    String str1 = paramMessageEvent.getMessage();
    String str2 = str1.toLowerCase();

    switch (paramMessageEvent.getID()) {
    case 0:
      if ((str1.contains("You've just advanced")) && 
        (this.screenshots)) {
        this.env.saveScreenshot(true);
        log("Congrats on level up! Screenshot taken =D");
        sleep(random(1500, 2500));
        if (this.interfaces.canContinue()) {
          this.interfaces.clickContinue();
        }
      }

      if ((str1.contains("current role")) && 
        (inGame()) && 
        (!this.switchingRole))
        this.switchingRole = true;
      String str3;
      String str4;
      int i;
      int j;
      if (str2.contains("you won")) {
        this.gamesPlayed += 1;
        this.gamesWon += 1;
        str3 = str2.substring(str2.indexOf("you had") + 8, str2.indexOf("charges") - 1);

        str4 = str2.substring(str2.indexOf("opponent had") + 13, str2.lastIndexOf("."));

        if (this.dmode) {
          log("Strings: You: " + str3 + " Opponent: " + str4);
        }

        i = Integer.parseInt(str3);
        j = Integer.parseInt(str4);
        if (this.dmode) {
          log("Ints: You: " + i + " Opponent: " + j);
        }
        this.totalCharges += i;
        this.totalChargesO += j;
        this.averageCharges = (this.totalCharges / this.gamesPlayed);
        this.averageChargesOpponent = (this.totalChargesO / this.gamesPlayed);
      }
      if (str2.contains("you lost")) {
        this.gamesPlayed += 1;
        this.gamesLost += 1;
        str3 = str2.substring(str2.indexOf("you had") + 8, str2.indexOf("charges") - 1);

        str4 = str2.substring(str2.indexOf("opponent had") + 13, str2.lastIndexOf("."));

        if (this.dmode) {
          log("Strings: You: " + str3 + " Opponent: " + str4);
        }

        i = Integer.parseInt(str3);
        j = Integer.parseInt(str4);
        if (this.dmode) {
          log("Ints: You: " + i + " Opponent: " + j);
        }
        this.totalCharges += i;
        this.totalChargesO += j;
        this.averageCharges = (this.totalCharges / this.gamesPlayed);
        this.averageChargesOpponent = (this.totalChargesO / this.gamesPlayed);
      }

      if ((!str1.contains("The following item is not allowed")) || 
        (!inLobby())) break;
      this.bankingUBIs = true;
      this.UBIString = str1;
    case 2:
      if ((paramMessageEvent.getSender().equals(getMyPlayer().getName())) && 
        (str2.contains("1"))) {
        this.goReceived = true;
        this.status = "'1' Received";
      }
    }
  }

  public void switchRole()
  {
    this.status = "Switching Role...";
    if (this.round == 1) {
      if (this.hunted) {
        this.hunted = false;
        this.roundOneHunted = false;
      } else {
        this.hunted = true;
        this.roundOneHunted = true;
      }
    } else if (this.round == 2) {
      if (this.hunted2)
        this.hunted2 = false;
      else {
        this.hunted2 = true;
      }
    }

    int i = 1;
    try {
      RSObject localRSObject = this.objects.getNearest(new int[] { 30143 });
      if (localRSObject != null)
        i = 0;
    }
    catch (NullPointerException localNullPointerException)
    {
    }
    Object localObject;
    if (i != 0) {
      localObject = new RSTile(1693, 5675);
      while ((this.calc.distanceTo((RSTile)localObject) > 5) && (inGame()))
        this.walking.walkPathMM(this.walking.findPath((RSTile)localObject));
    }
    else {
      localObject = this.objects.getNearest(new int[] { 30143 });
      RSTile localRSTile = new RSTile(((RSObject)localObject).getLocation().getX() + 1, ((RSObject)localObject).getLocation().getY());

      while ((this.calc.distanceTo(localRSTile) > 5) && (inGame())) {
        this.walking.walkPathMM(this.walking.findPath(localRSTile));
        sleep(random(500, 1000));
      }

    }

    if (this.dmode) {
      log("Switching Role...");
    }
    if (this.round == 1) {
      if (this.hunted) {
        getStoneSwitch();
        wieldStone();
        if (this.teleorb.equals("hunted"))
          useTeleOrb();
        else if ((this.teleorb.equals("random")) && 
          (this.tRandom > 500))
          useTeleOrb();
      }
      else
      {
        setSearchTiles();
        setupStyleEquipment();
        setupStyle();
        if (this.currentStyle.equals("Magic")) {
          setSpell();
        }
        if (this.teleorb.equals("hunting"))
          useTeleOrb();
        else if ((this.teleorb.equals("random")) && 
          (this.tRandom <= 500)) {
          useTeleOrb();
        }
      }
    }
    else if (this.round == 2) {
      if (this.hunted2) {
        getStoneSwitch();
        wieldStone();
        if (this.teleorb.equals("hunted"))
          useTeleOrb();
        else if ((this.teleorb.equals("random")) && 
          (this.tRandom > 500))
          useTeleOrb();
      }
      else
      {
        setSearchTiles();
        setupStyleEquipment();
        setupStyle();
        if (this.currentStyle.equals("Magic")) {
          setSpell();
        }
        if (this.teleorb.equals("hunting"))
          useTeleOrb();
        else if ((this.teleorb.equals("random")) && 
          (this.tRandom <= 500)) {
          useTeleOrb();
        }
      }
    }

    this.switchingRole = false;
  }

  public void clearItemListArrays()
  {
    this.meleeListIDsAdded[0] = -1;
    this.meleeListIDsAdded[1] = -1;
    this.meleeListIDsAdded[2] = -1;
    this.meleeListIDsAdded[3] = -1;
    this.meleeListIDsAdded[4] = -1;
    this.meleeListIDsAdded[5] = -1;
    this.meleeListIDsAdded[6] = -1;
    this.meleeListIDsAdded[7] = -1;
    this.meleeListIDsAdded[8] = -1;
    this.meleeListIDsAdded[9] = -1;
    this.meleeListIDsAdded[10] = -1;

    this.magicListIDsAdded[0] = -1;
    this.magicListIDsAdded[1] = -1;
    this.magicListIDsAdded[2] = -1;
    this.magicListIDsAdded[3] = -1;
    this.magicListIDsAdded[4] = -1;
    this.magicListIDsAdded[5] = -1;
    this.magicListIDsAdded[6] = -1;
    this.magicListIDsAdded[7] = -1;
    this.magicListIDsAdded[8] = -1;
    this.magicListIDsAdded[9] = -1;
    this.magicListIDsAdded[10] = -1;

    this.rangeListIDsAdded[0] = -1;
    this.rangeListIDsAdded[1] = -1;
    this.rangeListIDsAdded[2] = -1;
    this.rangeListIDsAdded[3] = -1;
    this.rangeListIDsAdded[4] = -1;
    this.rangeListIDsAdded[5] = -1;
    this.rangeListIDsAdded[6] = -1;
    this.rangeListIDsAdded[7] = -1;
    this.rangeListIDsAdded[8] = -1;
    this.rangeListIDsAdded[9] = -1;
    this.rangeListIDsAdded[10] = -1;
  }

  public void clearItemListArraysDefence()
  {
    this.meleeListIDsAddedDefence[0] = -1;
    this.meleeListIDsAddedDefence[1] = -1;
    this.meleeListIDsAddedDefence[2] = -1;
    this.meleeListIDsAddedDefence[3] = -1;
    this.meleeListIDsAddedDefence[4] = -1;
    this.meleeListIDsAddedDefence[5] = -1;
    this.meleeListIDsAddedDefence[6] = -1;
    this.meleeListIDsAddedDefence[7] = -1;
    this.meleeListIDsAddedDefence[8] = -1;
    this.meleeListIDsAddedDefence[9] = -1;
    this.meleeListIDsAddedDefence[10] = -1;

    this.magicListIDsAddedDefence[0] = -1;
    this.magicListIDsAddedDefence[1] = -1;
    this.magicListIDsAddedDefence[2] = -1;
    this.magicListIDsAddedDefence[3] = -1;
    this.magicListIDsAddedDefence[4] = -1;
    this.magicListIDsAddedDefence[5] = -1;
    this.magicListIDsAddedDefence[6] = -1;
    this.magicListIDsAddedDefence[7] = -1;
    this.magicListIDsAddedDefence[8] = -1;
    this.magicListIDsAddedDefence[9] = -1;
    this.magicListIDsAddedDefence[10] = -1;

    this.rangeListIDsAddedDefence[0] = -1;
    this.rangeListIDsAddedDefence[1] = -1;
    this.rangeListIDsAddedDefence[2] = -1;
    this.rangeListIDsAddedDefence[3] = -1;
    this.rangeListIDsAddedDefence[4] = -1;
    this.rangeListIDsAddedDefence[5] = -1;
    this.rangeListIDsAddedDefence[6] = -1;
    this.rangeListIDsAddedDefence[7] = -1;
    this.rangeListIDsAddedDefence[8] = -1;
    this.rangeListIDsAddedDefence[9] = -1;
    this.rangeListIDsAddedDefence[10] = -1;
  }

  public boolean maging() {
    int i = getMyPlayer().getAnimation();

    return (i == 14221) || (i == 14220) || (i == 14222) || (i == 14223) || (i == 10546) || (i == 10542) || (i == 14209) || (i == 2791) || (i == 1978) || (i == 1979) || (i == -1);
  }

  public void setDefenceStyle()
  {
    int i = 0;
    int j = -1;
    try {
      j = getPlayerThrow().getAnimation();
    } catch (NullPointerException localNullPointerException) {
      j = -1;
    }
    if ((j == 14221) || (j == 14220) || (j == 14222) || (j == 14223) || (j == 10546) || (j == 10542) || (j == 14209) || (j == 2791) || (j == 1978) || (j == 1979))
    {
      if (this.magicActiveDefence) {
        this.currentStyleDefence = "Magic";
        i = 1;
      }
    } else if ((j == 426) || (j == 4230) || (j == 2075))
    {
      if (this.rangeActiveDefence) {
        this.currentStyleDefence = "Range";
        i = 1;
      }
    } else if ((j != -1) && (j != 9012) && (j != 710) && (j != 716) && (j != 717) && (j != 718) && (j != 1161) && (j != 1163) && (j != 1164) && (j != 1165) && (j != 12806))
    {
      if (this.meleeActiveDefence) {
        this.currentStyleDefence = "Melee";
        i = 1;
      }
    }
    if (i != 0) {
      setupStyleDefence();
      this.game.openTab(4);
    }
  }

  public void setQuickPrayers(boolean paramBoolean) {
    if (this.skills.getCurrentLevel(5) > 0)
    {
      int i;
      int j;
      int k;
      if (paramBoolean) {
        if (this.interfaces.get(749).getComponent(1).containsAction("Turn quick prayers on"))
        {
          i = this.round;
          j = 0;
          k = 0;

          while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
            if (this.interfaces.get(749).getComponent(1).doAction("Turn quick prayers on"))
            {
              k = 1;
            }
            j++;
          }
        }
      } else if ((!paramBoolean) && 
        (this.interfaces.get(749).getComponent(1).containsAction("Turn prayers off")))
      {
        i = this.round;
        j = 0;
        k = 0;

        while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
          if (this.interfaces.get(749).getComponent(1).doAction("Turn prayers off"))
          {
            k = 1;
          }
          j++;
        }
      }
    }
  }

  public void turnOffPrayer()
  {
    if (this.lastPrayerSet == 17) {
      this.status = "Turning Off Prayer...";
      this.game.openTab(6);
      this.mouse.move(645, 340);
      sleep(101);
      if (setPrayer(17, false))
        this.lastPrayerSet = 0;
    }
    else if (this.lastPrayerSet == 18) {
      this.status = "Turning Off Prayer...";
      this.game.openTab(6);
      this.mouse.move(683, 340);
      sleep(101);
      if (setPrayer(18, false))
        this.lastPrayerSet = 0;
    }
    else if (this.lastPrayerSet == 19) {
      this.status = "Turning Off Prayer...";
      this.game.openTab(6);
      this.mouse.move(718, 340);
      sleep(101);
      if (setPrayer(19, false)) {
        this.lastPrayerSet = 0;
      }
    }
    this.game.openTab(4);
  }

  public void turnOffAttackPrayer() {
    if ((this.lastAttackPrayerSet == 1) || (this.lastAttackPrayerSet == 2) || (this.lastAttackPrayerSet == 3) || (this.lastAttackPrayerSet == 4) || (this.lastAttackPrayerSet == 6) || (this.lastAttackPrayerSet == 7) || (this.lastAttackPrayerSet == 11) || (this.lastAttackPrayerSet == 12) || (this.lastAttackPrayerSet == 14) || (this.lastAttackPrayerSet == 15) || (this.lastAttackPrayerSet == 20) || (this.lastAttackPrayerSet == 21))
    {
      this.status = "Turning Off Attack Prayer...";
      this.game.openTab(6);
      int i = this.round;
      int j = 0;
      int k = 0;
      while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
        if (setPrayer(this.lastAttackPrayerSet, false)) {
          k = 1;
          this.lastAttackPrayerSet = 0;
        }
        j++;
      }
      this.game.openTab(4);
    }
  }

  public void setAttackPrayer() {
    this.prayerlvl = this.skills.getRealLevel(5);
    if (this.useAttackPrayers)
    {
      int i;
      int j;
      int k;
      if (this.currentStyle.equals("Melee")) {
        if (this.meleeAttackStyle.equals("Strength EXP")) {
          if (this.prayerlvl >= 31) {
            if (this.lastAttackPrayerSet != 14) {
              this.status = "Setting Attack Prayer...";
              i = this.round;
              this.game.openTab(6);
              this.mouse.setSpeed(this.mouseSpeed);
              sleep(101);
              j = 0;
              k = 0;

              while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
                if (setPrayer(14, true)) {
                  k = 1;
                  this.lastAttackPrayerSet = 14;
                }
                j++;
              }
              this.mouse.setSpeed(this.mouseSpeed);
            }
          } else if (this.prayerlvl >= 13) {
            if (this.lastAttackPrayerSet != 6) {
              this.status = "Setting Attack Prayer...";
              i = this.round;
              this.game.openTab(6);
              this.mouse.setSpeed(this.mouseSpeed);
              sleep(101);
              j = 0;
              k = 0;

              while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
                if (setPrayer(6, true)) {
                  k = 1;
                  this.lastAttackPrayerSet = 6;
                }
                j++;
              }
              this.mouse.setSpeed(this.mouseSpeed);
            }
          } else if ((this.prayerlvl >= 4) && 
            (this.lastAttackPrayerSet != 1)) {
            this.status = "Setting Attack Prayer...";
            i = this.round;
            this.game.openTab(6);
            this.mouse.setSpeed(this.mouseSpeed);
            sleep(101);
            j = 0;
            k = 0;

            while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
              if (setPrayer(1, true)) {
                k = 1;
                this.lastAttackPrayerSet = 1;
              }
              j++;
            }
            this.mouse.setSpeed(this.mouseSpeed);
          }
        }
        else if (this.meleeAttackStyle.equals("Attack EXP")) {
          if (this.prayerlvl >= 34) {
            if (this.lastAttackPrayerSet != 15) {
              this.status = "Setting Attack Prayer...";
              i = this.round;
              this.game.openTab(6);
              this.mouse.setSpeed(this.mouseSpeed);
              sleep(101);
              j = 0;
              k = 0;

              while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
                if (setPrayer(15, true)) {
                  k = 1;
                  this.lastAttackPrayerSet = 15;
                }
                j++;
              }
              this.mouse.setSpeed(this.mouseSpeed);
            }
          } else if (this.prayerlvl >= 16) {
            if (this.lastAttackPrayerSet != 7) {
              this.status = "Setting Attack Prayer...";
              i = this.round;
              this.game.openTab(6);
              this.mouse.setSpeed(this.mouseSpeed);
              sleep(101);
              j = 0;
              k = 0;

              while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
                if (setPrayer(7, true)) {
                  k = 1;
                  this.lastAttackPrayerSet = 7;
                }
                j++;
              }
              this.mouse.setSpeed(this.mouseSpeed);
            }
          } else if ((this.prayerlvl >= 7) && 
            (this.lastAttackPrayerSet != 2)) {
            this.status = "Setting Attack Prayer...";
            i = this.round;
            this.game.openTab(6);
            this.mouse.setSpeed(this.mouseSpeed);
            sleep(101);
            j = 0;
            k = 0;

            while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
              if (setPrayer(2, true)) {
                k = 1;
                this.lastAttackPrayerSet = 2;
              }
              j++;
            }
            this.mouse.setSpeed(this.mouseSpeed);
          }
        }
      }
      else if (this.currentStyle.equals("Magic")) {
        if (this.prayerlvl >= 45) {
          if (this.lastAttackPrayerSet != 21) {
            this.status = "Setting Attack Prayer...";
            i = this.round;
            this.game.openTab(6);
            this.mouse.setSpeed(this.mouseSpeed);
            sleep(101);
            j = 0;
            k = 0;

            while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
              if (setPrayer(21, true)) {
                k = 1;
                this.lastAttackPrayerSet = 21;
              }
              j++;
            }
            this.mouse.setSpeed(this.mouseSpeed);
          }
        } else if (this.prayerlvl >= 27) {
          if (this.lastAttackPrayerSet != 12) {
            this.status = "Setting Attack Prayer...";
            i = this.round;
            this.game.openTab(6);
            this.mouse.setSpeed(this.mouseSpeed);
            sleep(101);
            j = 0;
            k = 0;

            while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
              if (setPrayer(12, true)) {
                k = 1;
                this.lastAttackPrayerSet = 12;
              }
              j++;
            }
            this.mouse.setSpeed(this.mouseSpeed);
          }
        } else if ((this.prayerlvl >= 9) && 
          (this.lastAttackPrayerSet != 4)) {
          this.status = "Setting Attack Prayer...";
          i = this.round;
          this.game.openTab(6);
          this.mouse.setSpeed(this.mouseSpeed);
          sleep(101);
          j = 0;
          k = 0;

          while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
            if (setPrayer(4, true)) {
              k = 1;
              this.lastAttackPrayerSet = 4;
            }
            j++;
          }
          this.mouse.setSpeed(this.mouseSpeed);
        }
      }
      else if (this.currentStyle.equals("Range"))
        if (this.prayerlvl >= 44) {
          if (this.lastAttackPrayerSet != 20) {
            this.status = "Setting Attack Prayer...";
            i = this.round;
            this.game.openTab(6);
            this.mouse.setSpeed(this.mouseSpeed);
            sleep(101);
            j = 0;
            k = 0;

            while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
              if (setPrayer(20, true)) {
                k = 1;
                this.lastAttackPrayerSet = 20;
              }
              j++;
            }
            this.mouse.setSpeed(this.mouseSpeed);
          }
        } else if (this.prayerlvl >= 26) {
          if (this.lastAttackPrayerSet != 11) {
            this.status = "Setting Attack Prayer...";
            i = this.round;
            this.game.openTab(6);
            this.mouse.setSpeed(this.mouseSpeed);
            sleep(101);
            j = 0;
            k = 0;

            while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
              if (setPrayer(11, true)) {
                k = 1;
                this.lastAttackPrayerSet = 11;
              }
              j++;
            }
            this.mouse.setSpeed(this.mouseSpeed);
          }
        } else if ((this.prayerlvl >= 8) && 
          (this.lastAttackPrayerSet != 3)) {
          this.status = "Setting Attack Prayer...";
          i = this.round;
          this.game.openTab(6);
          this.mouse.setSpeed(this.mouseSpeed);
          sleep(101);
          j = 0;
          k = 0;

          while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
            if (setPrayer(3, true)) {
              k = 1;
              this.lastAttackPrayerSet = 3;
            }
            j++;
          }
          this.mouse.setSpeed(this.mouseSpeed);
        }
    }
  }

  public void setPrayer()
  {
    this.prayerlvl = this.skills.getRealLevel(5);
    if (this.usePrayers)
    {
      int i;
      try
      {
        i = getPlayer().getAnimation();
      } catch (NullPointerException localNullPointerException) {
        i = -1;
      }
      int j;
      int k;
      int m;
      if ((i == 14221) || (i == 14220) || (i == 14222) || (i == 14223) || (i == 10546) || (i == 10542) || (i == 14209) || (i == 2791) || (i == 1978) || (i == 1979))
      {
        if ((this.prayerlvl >= 37) && (this.lastPrayerSet != 17)) {
          this.status = "Setting Prayer...";
          this.game.openTab(6);
          this.mouse.setSpeed(this.mouseSpeed);
          this.mouse.move(645, 340);
          sleep(101);
          j = this.round;
          k = 0;
          m = 0;

          while ((m == 0) && (k < 10) && (inGame()) && (this.round == j)) {
            if (setPrayer(17, true)) {
              m = 1;
              this.lastPrayerSet = 17;
            }
            k++;
          }
          this.mouse.setSpeed(this.mouseSpeed);
        }
      } else if ((i == 426) || (i == 4230) || (i == 2075))
      {
        if ((this.prayerlvl >= 40) && (this.lastPrayerSet != 18)) {
          this.status = "Setting Prayer...";
          this.game.openTab(6);
          this.mouse.setSpeed(this.mouseSpeed);
          sleep(101);
          this.mouse.move(683, 340);
          j = this.round;
          k = 0;
          m = 0;

          while ((m == 0) && (k < 10) && (inGame()) && (this.round == j)) {
            if (setPrayer(18, true)) {
              m = 1;
              this.lastPrayerSet = 18;
            }
            k++;
          }
          this.mouse.setSpeed(this.mouseSpeed);
        }
      } else if ((i != -1) && (i != 9012) && (i != 710) && (i != 716) && (i != 717) && (i != 718) && (i != 1161) && (i != 1163) && (i != 1164) && (i != 1165) && (i != 12806))
      {
        if ((this.prayerlvl >= 43) && (this.lastPrayerSet != 19)) {
          this.status = "Setting Prayer...";
          this.game.openTab(6);
          this.mouse.setSpeed(this.mouseSpeed);
          sleep(101);
          this.mouse.move(718, 340);
          j = this.round;
          k = 0;
          m = 0;

          while ((m == 0) && (k < 10) && (inGame()) && (this.round == j)) {
            if (setPrayer(19, true)) {
              m = 1;
              this.lastPrayerSet = 19;
            }
            k++;
          }
          this.mouse.setSpeed(this.mouseSpeed);
        }
      }
    }
  }

  public void setSkinPrayer() {
    this.prayerlvl = this.skills.getRealLevel(5);
    if (this.useSkinPrayers)
    {
      int i;
      int j;
      int k;
      if (this.prayerlvl >= 28) {
        if (this.lastSkinPrayerSet != 13) {
          this.status = "Setting Defence Prayer...";
          this.game.openTab(6);
          this.mouse.setSpeed(this.mouseSpeed);
          sleep(101);
          i = this.round;
          j = 0;
          k = 0;

          while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
            if (setPrayer(13, true)) {
              k = 1;
              this.lastSkinPrayerSet = 13;
            }
            j++;
          }
          this.mouse.setSpeed(this.mouseSpeed);
        }
      } else if (this.prayerlvl >= 10) {
        if (this.lastSkinPrayerSet != 5) {
          this.status = "Setting Defence Prayer...";
          this.game.openTab(6);
          this.mouse.setSpeed(this.mouseSpeed);
          sleep(101);
          i = this.round;
          j = 0;
          k = 0;

          while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
            if (setPrayer(5, true)) {
              k = 1;
              this.lastSkinPrayerSet = 5;
            }
            j++;
          }
          this.mouse.setSpeed(this.mouseSpeed);
        }
      }
      else if (this.lastSkinPrayerSet != 0) {
        this.status = "Setting Defence Prayer...";
        this.game.openTab(6);
        this.mouse.setSpeed(this.mouseSpeed);
        sleep(101);
        i = this.round;
        j = 0;
        k = 0;

        while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
          if (setPrayer(0, true)) {
            k = 1;
            this.lastSkinPrayerSet = 0;
          }
          j++;
        }
        this.mouse.setSpeed(this.mouseSpeed);
      }
    }
  }

  public void turnOffSkinPrayer()
  {
    if ((this.lastSkinPrayerSet == 0) || (this.lastSkinPrayerSet == 5) || (this.lastSkinPrayerSet == 13))
    {
      this.status = "Turning Off Defence Prayer...";
      this.game.openTab(6);
      sleep(101);
      int i = this.round;
      int j = 0;
      int k = 0;
      while ((k == 0) && (j < 10) && (inGame()) && (this.round == i)) {
        if (setPrayer(this.lastSkinPrayerSet, false)) {
          k = 1;
          this.lastSkinPrayerSet = -1;
        }
        j++;
      }
      this.game.openTab(4);
    }
  }

  public void turnCamera() {
    char[] arrayOfChar1 = { '%', '\'' };
    char[] arrayOfChar2 = { '(', '&' };
    char[] arrayOfChar3 = { '%', '\'', '&', '(' };

    int i = random(0, 2);
    int j = random(0, 2);
    int k = random(0, 4);

    if (random(0, 3) == 0) {
      this.keyboard.pressKey(arrayOfChar1[j]);
      sleep(random(250, 500));
      this.keyboard.pressKey(arrayOfChar2[i]);
      sleep(random(250, 500));
      this.keyboard.releaseKey(arrayOfChar2[i]);
      sleep(random(250, 500));
      this.keyboard.releaseKey(arrayOfChar1[j]);
    } else {
      this.keyboard.pressKey(arrayOfChar3[k]);
      sleep(random(250, 800));
      this.keyboard.releaseKey(arrayOfChar3[k]);
    }
    if (this.camera.getPitch() < 100)
      while (this.camera.getPitch() < 100) {
        char c = '&';
        this.keyboard.pressKey(c);
        sleep(1500);
        this.keyboard.releaseKey(c);
      }
  }

  public void lookAtLevels()
  {
    if ((inLobby()) || (inWaitingRoom())) {
      this.game.openTab(2);
      sleep(random(400, 750));
      int i;
      if (this.currentStyle.equals("Melee")) {
        i = random(1, 400);
        if ((i > 0) && (i < 101))
          this.skills.doHover(1);
        else if ((i > 100) && (i < 201))
          this.skills.doHover(4);
        else if ((i > 200) && (i < 301))
          this.skills.doHover(22);
        else if ((i > 300) && (i < 401))
          this.skills.doHover(2);
      }
      else if (this.currentStyle.equals("Magic")) {
        i = random(1, 200);
        if ((i > 0) && (i < 101))
          this.skills.doHover(87);
        else if ((i > 100) && (i < 201))
          this.skills.doHover(2);
      }
      else if (this.currentStyle.equals("Range")) {
        i = random(1, 200);
        if ((i > 0) && (i < 101))
          this.skills.doHover(46);
        else if ((i > 100) && (i < 201)) {
          this.skills.doHover(2);
        }
      }
      sleep(random(1200, 1750));
      this.game.openTab(4);
    }
  }

  public void antiBan() {
    switch (random(1, 50)) {
    case 1:
      turnCamera();
      break;
    case 2:
      turnCamera();
      break;
    case 3:
      turnCamera();
      break;
    case 4:
      turnCamera();
      break;
    case 5:
      this.mouse.move(random(50, 700), random(50, 450));
      break;
    case 6:
      this.mouse.move(random(50, 700), random(50, 450));
      break;
    case 7:
      this.mouse.move(random(50, 700), random(50, 450));
      break;
    case 8:
      this.mouse.move(random(50, 700), random(50, 450));
      break;
    case 9:
      lookAtLevels();
    }
  }

  public boolean mouseInArea(Rectangle paramRectangle)
  {
    return mouseInArea(paramRectangle.x, paramRectangle.y, paramRectangle.width, paramRectangle.height);
  }

  public boolean mouseInArea(int paramInt1, int paramInt2, int paramInt3, int paramInt4) {
    int i = paramInt1 + paramInt3;
    int j = paramInt2 + paramInt4;

    return (this.userMouseX >= paramInt1) && (this.userMouseX <= i) && (this.userMouseY >= paramInt2) && (this.userMouseY <= j);
  }

  public void mousePressed(MouseEvent paramMouseEvent)
  {
    switch (paramMouseEvent.getButton()) {
    case 1:
      this.userMousePressed = true;
    }
  }

  public void mouseReleased(MouseEvent paramMouseEvent)
  {
    switch (paramMouseEvent.getButton()) {
    case 1:
      this.userMousePressed = false;
      if (mouseInArea(this.statusButtonRec)) {
        if ((this.statusPaint == 1) || (this.statusPaint == 2))
          this.statusPaint = 3;
        else
          this.statusPaint = 1;
      }
      else if (mouseInArea(this.expButtonRec)) {
        if ((this.expPaint == 1) || (this.expPaint == 2))
          this.expPaint = 3;
        else
          this.expPaint = 1;
      }
      else if (mouseInArea(this.statsButtonRec)) {
        if ((this.statsPaint == 1) || (this.statsPaint == 2))
          this.statsPaint = 3;
        else
          this.statsPaint = 1;
      } else {
        if ((!mouseInArea(this.moreStatsButtonRec)) || (
          (this.statsPaint != 1) && (this.statsPaint != 2))) break;
        if ((this.moreStats == 0) || (this.moreStats == 3)) {
          this.moreStats = 1; } else {
          if ((this.moreStats != 2) && (this.moreStats != 1)) break;
          this.moreStats = 3;
        }
      }
    }
  }

  public void mouseMoved(MouseEvent paramMouseEvent)
  {
    this.userMouseX = paramMouseEvent.getX();
    this.userMouseY = paramMouseEvent.getY();
  }

  public void mouseClicked(MouseEvent paramMouseEvent)
  {
  }

  public void mouseDragged(MouseEvent paramMouseEvent)
  {
  }

  public void mouseEntered(MouseEvent paramMouseEvent)
  {
  }

  public void mouseExited(MouseEvent paramMouseEvent)
  {
  }

  int[] concat(int[] paramArrayOfInt1, int[] paramArrayOfInt2) {
    int[] arrayOfInt = new int[paramArrayOfInt1.length + paramArrayOfInt2.length];
    System.arraycopy(paramArrayOfInt1, 0, arrayOfInt, 0, paramArrayOfInt1.length);
    System.arraycopy(paramArrayOfInt2, 0, arrayOfInt, paramArrayOfInt1.length, paramArrayOfInt2.length);
    return arrayOfInt;
  }

  FOGRunner.FOGItem[] concat(FOGRunner.FOGItem[] paramArrayOfFOGItem1, FOGRunner.FOGItem[] paramArrayOfFOGItem2) {
    FOGRunner.FOGItem[] arrayOfFOGItem = new FOGRunner.FOGItem[paramArrayOfFOGItem1.length + paramArrayOfFOGItem2.length];
    System.arraycopy(paramArrayOfFOGItem1, 0, arrayOfFOGItem, 0, paramArrayOfFOGItem1.length);
    System.arraycopy(paramArrayOfFOGItem2, 0, arrayOfFOGItem, paramArrayOfFOGItem1.length, paramArrayOfFOGItem2.length);
    return arrayOfFOGItem;
  }

  public int maxInArray(int[] paramArrayOfInt) {
    int i = 0;
    for (int j = 0; j < paramArrayOfInt.length; j++) {
      i = Math.max(i, paramArrayOfInt[j]);
    }
    return i;
  }

  public boolean hoverMenuIndex(int paramInt) {
    if (!this.menu.isOpen())
      return false;
    try {
      String[] arrayOfString = this.menu.getItems();
      if (arrayOfString.length <= paramInt)
        return false;
      Point localPoint = this.menu.getLocation();
      int i = random(4, arrayOfString[paramInt].length() * 4);
      int j = 21 + 15 * paramInt + random(3, 12);
      this.mouse.move((int)localPoint.getX() + i, (int)localPoint.getY() + j, 2, 2);

      return this.menu.isOpen();
    }
    catch (Exception localException)
    {
      if (this.dmode)
        localException.printStackTrace();
    }
    return false;
  }

  public void dlog(String paramString) {
    if (this.dmode)
      log(paramString);
  }

  public boolean setPrayer(int paramInt, boolean paramBoolean)
  {
    RSComponent localRSComponent = this.interfaces.getComponent(271, 7);
    RSComponent[] arrayOfRSComponent = localRSComponent.getComponents();
    int i = 0;
    while ((arrayOfRSComponent.length <= paramInt) && (i < 75)) {
      localRSComponent = this.interfaces.getComponent(271, 7);
      arrayOfRSComponent = localRSComponent.getComponents();
      i++;
      sleep(1);
    }
    if (arrayOfRSComponent.length > paramInt) {
      return arrayOfRSComponent[paramInt].doAction(paramBoolean ? "Activate" : "Deactivate");
    }

    if (this.dmode) {
      log("Prayer Array Too Short");
    }

    return false;
  }
}